Jump to content

adding extra coloumn messes up my output


Jaynesh

Recommended Posts

Hello

 

I have an sql query which is working perfectly.

 

SELECT DISTINCT dbPosts.post

FROM dbPosts

 

LEFT JOIN ( dbUsers, dbFriends, dbPosts_share )

 

ON (

dbPosts.username_id = dbUsers.id

AND (dbPosts.username_id = dbFriends.user_id)

OR

(dbPosts.username_id = dbFriends.friend_id)

)

 

but when I add an extra column, it duplicates each output several times.

 

SELECT DISTINCT dbPosts.post, dbUsers.username

FROM dbPosts

 

LEFT JOIN ( dbUsers, dbFriends, dbPosts_share )

 

ON (

dbPosts.username_id = dbUsers.id

AND (dbPosts.username_id = dbFriends.user_id)

OR

(dbPosts.username_id = dbFriends.friend_id)

)

 

Why is this happening?

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.