Jump to content

select values from 2 tables with 1 query


robs99

Recommended Posts

hey,

ive got problem. im trying to kind of combine 2 tables in one query. ive searched and tried to look at examples but i didnt get it to work :( lets say i have 2 tables. one with posts which looks like this:

posts:

post_id, content, author

 

and one which saves the post-id of a flagged post and the user-id of the user who flagged it

flags:

post_id, user_id

 

what i want to do is show whether a post has been flagged or not in one query. lets say display the output like this:

post_id, content, author, flagged (flagged can be true or false)

 

is there a way to do is? sorry for sounding so confusing ive tried to find a solutions for the past 3 hours and my head is about to burst...

Archived

This topic is now archived and is 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.