MySQL Forums
Forum List  »  Optimizer & Parser

Left Join Problem
Posted by: Clodelio Delfino
Date: August 22, 2006 11:30PM

Need help on below query...

Scenario:

TABLES:

setup_main
sid (primary)
sdata1
sdata2

output1
oid
sid
outdata
outdate_end

output2
oid
sid
outdate_end

output3
oid
sid
outdata
outdate_end


Query:

SELECT
s.sid, s.sdata1, s.sdata2
FROM
((setup_main AS s
LEFT JOIN
output1 AS o1 ON s.sid = o1.sid)
LEFT JOIN
output2 AS o2 ON s.sid = o2.sid)
LEFT JOIN
output3 AS o3 ON s.sid = o3.sid
WHERE
(
o1.outdate_end
BETWEEN
'PREVDATE' AND 'CURDATE'
OR
o2.outdate_end
BETWEEN
'PREVDATE' AND 'CURDATE'
OR
o3.outdate_end
BETWEEN
'PREVDATE' AND 'CURDATE'
)

The query returned results not according to date range (PREVDATE and CURDATE), may I ask for a help on how do I achieve having a results based on the given PREVDATE and CURDATE variables...

Any input is deeply appreciated.

cheerz

Options: ReplyQuote


Subject
Views
Written By
Posted
Left Join Problem
2580
August 22, 2006 11:30PM
1773
August 23, 2006 09:00AM
1764
August 23, 2006 06:53PM
1696
August 23, 2006 07:12PM
1886
August 23, 2006 11:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.