Hi all

I'm trying to get an sql statement working and just can't get it.

I have a header/detail table and want to create one table in order to report
from it.

Header -->Work Date=2006/11/06, Clock Number=0001,TimeSheet=1
Detail -->Work done=Repair, Timesheet=1
Detail-->Work done=Fix, Timesheet=1
Header -->Work Date=2006/11/06, Clock Number=0002,TimeSheet=2
Header -->Work Date=2006/11/06, Clock Number=0003,TimeSheet=3
Header -->Work Date=2006/11/06, Clock Number=0004,TimeSheet=4
Detail -->Work done=Repair, Timesheet=1

Timesheet 2& 3 do not have any work booked so there is no child records.

Ideally what I'm trying to end up with is one row for each header: -

header_date,Header_clock,header_timesheet, detail_work, detail_timesheet
2006/11/06, 0001,1,repair,1
2006/11/06, 0001,2,fix,2
2006/11/06,0002,3,"",""
etc

I've tried : -
select header.*,detail.* from detail inner join header on
detail.timesheet=header.timesheet
will miss out timesheets 2& 3 because no work was booked on the day in
question

select header.*, detail.* from header right join detail on
header.timesheet=detail.timesheet

What am I missing other than my brains today?

Thanks all



Graham Brown
CompSYS Software Solutions

Telephone: 0870 753 8480
General fax: 0870 753 8490
Support fax: 0845 009 4480
Mobile: 07973 988939
email: [EMAIL PROTECTED]
web: http://www.compsys.co.uk

CompSYS is a member of the BNI (Business Network International). If you'd
like to know how the BNI could grow your business or would like to visit one
of the weekly meetings held throughout the area, please let me know.

BNI Plains chapter members cover the following professions: -

Graphic Design, Financial Advisor, Telecoms, Computer Hardware, Banking
Services, Solicitors, Accountancy, Civil Engineers, Estate Agency, Double
Glazing Specialist, Sign Maker, Painting and Decorating and Training
Services.

If you require any of these please let me know and I'll put you in touch.

IMPORTANT: This email (including all attachments) is confidential and may be
privileged. It may only be read, copied and used by the intended recipients.
If you are not the intended recipient, you should not disseminate,
distribute or copy this email. Please notify the sender immediately and
delete this email from your system.

The security and reliability of emails is not guaranteed. Verification
should be sought from a mailed or faxed copy. Whilst we operate anti-virus
programmes, emails can become infected after being transmitted. You should
therefore take full responsibility for virus checking.


--- StripMime Report -- processed MIME parts ---
multipart/related
  multipart/alternative
    text/plain (text body -- kept)
    text/html
  image/jpeg
---


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to