I'm trying to create a dynamic results table layout from 4 tables.
I want to have the data from the 2 tables asstatusupdate and asstatusdata even if the other two tables do not have a matching record.
I also want to group the tables results for asstatusupdate and asstatusdata i've tried this in sql but did not get the results that i need.
i need to have it retrive one record for asstatusupdate and asstatusdata and many records for asmanystatusupdate and ascomments. grouping by asstatusupdate.
Thanks in advance for your help!
here is the query:
Expand|Select|Wrap|Line Numbers
- SELECT a.Id, a.Type,
- a.Dates,
- a.UIdFk,
- b.Id as Did,
- b.comment,
- b.dates as Day,
- b.sfk as Sfk ,
- c.sfk as sfk1,
- d.Memo as Memo
- FROM
- asstatusupdate as a,
- left join asstatusdata as b
- on a.Id=b.sfk
- left join asmanystatusupdate as c
- on b.sfk=c.sfk
- left join ascomments as d
- on c.cfk=d.id
- where a.uidfk='1'