Hello,

Try this...

select a.rhrqid,a.rhrqsid,a.rhrssid,b.sid,b.rlsid
from rqhistory a left join relay b
on (a.rhrqid = b.rqid and (a.rhrqsid = b.rlsid or a.rhrqsid = b.sid or
a.rhrssid = b.rlsid or a.rhrssid = b.sid))
where a.rhrqsid = 101 or a.rhrssid = 101

Thanks,
ViSolve DB Team



----- Original Message ----- From: "KMiller" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Tuesday, February 06, 2007 8:37 AM
Subject: outer join question



This query isn't what I want...

select a.rhrqid,a.rhrqsid,a.rhrssid,b.sid,b.rlsid
from rqhistory a left join relay b
on a.rhrqsid = 101 or a.rhrssid = 101
and (a.rhrqid = b.rqid and (a.rhrqsid = b.rlsid or a.rhrqsid = b.sid or
a.rhrssid = b.rlsid or a.rhrssid = b.sid))

because it returns all rows from 'a' regardless of the criteria 101

Any advice on how would I get only rows from 'a' that match 101 and any in
'b' that match if they exist?

-km
--
View this message in context: http://www.nabble.com/outer-join-question-tf3178361.html#a8819711
Sent from the MySQL - General mailing list archive at Nabble.com.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.411 / Virus Database: 268.17.25/669 - Release Date: 2/4/2007




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to