Jump to content

simple select query


dave09

Recommended Posts

ok, maybe not that simple...

MYSQL 5.0.58

 

it's basically for use on ipb but I figured I might get a better answer here.

 

2 tables

 

ibf_posts

author_idtopic_id

11000

11001

21001

21002

 

ibf_topics

tid

1000

1001

1002

 

return  "SELECT DISTINCT(p.author_id), t.* 
    				FROM ibf_topics t
			  		LEFT JOIN ibf_posts p ON (p.topic_id=t.tid )
			 	WHERE p.author_id=1
			 	";

 

this gets the inverse of what I want.

if I do p.author_id!=1 ... it picks up the 2 1001 which I don't want.

 

In the table above, I only want tid 1002 returned for author_id 1.

 

any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.