Jump to content

Getting this in one query/result


SyncViews

Recommended Posts

tabel users
user_id
user_name
...

tabel pms
to
from
...

The id's from the pms (to and from) tabel match up with the users in the users tabel. I though about doing it like below but thats makes two rows for one pm but I only want one row :(

 

SELECT users.user_id, users.user_name,
           pms.pm_id, pms.time, pms.content, pms.subject
FROM users, pms
WHERE pms.to = users.user_id OR pms.from = users.user_id

 

is there someway I can make it just one row per pm with a result like this?

pm_id
time
content
subject
to.user_id
to.user_name
from.user_id
from.user_name

Link to comment
https://forums.phpfreaks.com/topic/101178-getting-this-in-one-queryresult/
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.