mysql - union query..want to be join
Posted: Tue May 29, 2007 8:34 am
feyd | Please use
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have the below sql statement as a union which isnt working correctly. I think that a join will work but Im not exactly sure how to use it.
I have 2 id numbers that pull a person's name from a 2nd table..the name is pulled from the same field for both id numbers.
[syntax="sql"]
Select timeclock.id.name as monname, '' as opname, monlog.monid, monlog.opid,monlog.mondate, monlog.montime, monlog.score, monlog.deductions, monlog.comments, monlog.campaign from timeclock.id,monlog where timeclock.id.operator=monlog.monid and mondate='2007-05-29' and monlog.monid='b5766' and monlog.opid='b6734' UNION select '' as monname,timeclock.id.name as opname, monlog.monid, monlog.opid,monlog.mondate, monlog.montime, monlog.score, monlog.deductions, monlog.comments, monlog.campaign from timeclock.id,monlog where timeclock.id.operator=monlog.opid and mondate='2007-05-29' and monlog.monid='b5766' and monlog.opid='b6734' \Gfeyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]