Jump to content

Not sure how to approach this query


sciencebear

Recommended Posts

I have a table I want to select from twice. It's called updates and I first want to select all updates where the username is equal to a variable $username. Second, in the same table, I want to select again from the table each update whose id matches the id in a second table, comments, where friendname is equal to the same variable $username. I then want to order all of these by id. I tried a few variations on JOINs but couldn't get it to work quite the way I wanted. I was thinking maybe something with a UNION but I couldn't figure out a working syntax for that either. Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/187710-not-sure-how-to-approach-this-query/
Share on other sites

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.