Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:58:43+00:00 2026-06-01T19:58:43+00:00

I’m breaking my head on this simple peace of code, that doesn’t want to

  • 0

I’m breaking my head on this simple peace of code, that doesn’t want to work, and I can’t think of any other solution…

Could you please help to make it work?

SELECT chart FROM chart WHERE (select count(user_id) FROM users join charts ON
user_id=charts.UID and charts.chart=chart WHERE INET_NTOA(user_ip)='127.0.0.1')=0;

There are 3 tables involved with the following columns:

chart(
chart int(5)
);

charts(
UID int(11),
chart int(5)
);

`users` (
`user_id` int(11),
`user_ip` int(10)
);

The point is that the ‘chart’ column from first select should be passed to subquery to charts.chart= chart, but instead the subquery ends up comparing with itself i.e. chart=chart – always true.

I know it wont work like that… but I can’t think of any other way really. Is there any way at all to the thing that I’m trying to do?

EDIT 1:
Basically I need a reverse selection:

  select chart.chart from chart join charts on chart.chart=charts.chart join users
  on user_id=charts.UID and INET_NTOA(user_ip)='127.0.0.1';

This query returns charts that are tagged by user with given ip, eg: 1, 4,5, 9.
But I need to select the ones that are not tagged instead, that is: 2,3,6,7,8,10 and so on…

EDIT 2:
I’m looking for some sort of negative join now. I think this would do, but I’m clueless how to use it. Meanwhile making some research…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:58:44+00:00Added an answer on June 1, 2026 at 7:58 pm

    Try:

    SELECT c.chart FROM chart c
    LEFT JOIN
    ( SELECT cn.chart FROM chart cn
      JOIN charts cs ON cn.chart = cs.chart
      JOIN users u ON u.user_id = cs.UID
      WHERE user_ip = 2130706433 ) charts_localhost
    ON c.chart = charts_localhost.chart
    WHERE charts_localhost.chart IS NULL
    

    Note that instead of INET_NTOA(user_ip)='127.0.0.1' it’s much better to use

    user_ip = 2130706433 which is equivalent but also index friendly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.