StLouieMIke
11-14-2009, 01:08 PM
I'm kinda new at this and I am getting into some more complex issues and I could use a hand, I have a select query that works ok now but I need to add more detail to it.
current query:
$query = "SELECT * FROM mess WHERE
toid='$fsnid' OR toid='9223372036854775807' AND status='a' ORDER BY toid ASC LIMIT 30";
mess is a table I am using to stream messages to users on my site I have another table called friends which contains 2 fields fsnid and friendsid I would like to be able to further limit the above query to only allow non friends (friendid=null) messages to be displayed when mess.messtype='c'.
I was thinking query below would do it but no such luck:
$query ="SELECT fromname,datetime,message,fromid
FROM mess
LEFT JOIN friends
ON mess.toid=$fsnid OR mess.toid='9223372036854775807'
and mess.status='a'
WHERE friends.friendsid=NULL AND mess.messtype='c'
ORDER BY toid ASC LIMIT 30";
Thanks
MC
current query:
$query = "SELECT * FROM mess WHERE
toid='$fsnid' OR toid='9223372036854775807' AND status='a' ORDER BY toid ASC LIMIT 30";
mess is a table I am using to stream messages to users on my site I have another table called friends which contains 2 fields fsnid and friendsid I would like to be able to further limit the above query to only allow non friends (friendid=null) messages to be displayed when mess.messtype='c'.
I was thinking query below would do it but no such luck:
$query ="SELECT fromname,datetime,message,fromid
FROM mess
LEFT JOIN friends
ON mess.toid=$fsnid OR mess.toid='9223372036854775807'
and mess.status='a'
WHERE friends.friendsid=NULL AND mess.messtype='c'
ORDER BY toid ASC LIMIT 30";
Thanks
MC