SQL help for the novice!

S

SokkiHong

Here is the SQL code I used for a query to get the latest
status for the respective ID's.

SELECT T.*
FROM [Issues SubTable] AS T
WHERE (((T.Date)=(SELECT Max(X.Date) FROM [Issues
SubTable] AS X WHERE T.ID =X.ID)));

Issues Master Table has fields such as ID, Owner,
Description, Resolution & etc..

Issues SubTable has fields such as entered dates and the
status regarding that issues. So multiple entries of
status can occur under one ID.

SubTable is set as a Child, and the Master as a Parent.

This query is pulling from the master table which has all
100 ID's. However, within the Master Table, if a
particular ID does not contain any date & status entry for
the respective ID it will simply not output anything. I
want it to show all of the ID's regardless of whether they
have status associated with it or not, so that the end
result will show all of the 100 ID's and the latest status
updates for the ones that have the status and blanks for
those that don't. Thanks for your help.
 
M

Marshall Barton

SokkiHong said:
Here is the SQL code I used for a query to get the latest
status for the respective ID's.

SELECT T.*
FROM [Issues SubTable] AS T
WHERE (((T.Date)=(SELECT Max(X.Date) FROM [Issues
SubTable] AS X WHERE T.ID =X.ID)));

Issues Master Table has fields such as ID, Owner,
Description, Resolution & etc..

Issues SubTable has fields such as entered dates and the
status regarding that issues. So multiple entries of
status can occur under one ID.

SubTable is set as a Child, and the Master as a Parent.

This query is pulling from the master table which has all
100 ID's. However, within the Master Table, if a
particular ID does not contain any date & status entry for
the respective ID it will simply not output anything. I
want it to show all of the ID's regardless of whether they
have status associated with it or not, so that the end
result will show all of the 100 ID's and the latest status
updates for the ones that have the status and blanks for
those that don't.

You failed to include the query with the "master" table so I
don't know what the problem is. However, I suspect that it
includes the latest status query and the master table, but
they're connected with an inner join when you want an outer
join. Try right clicking on the line connecting the table
and the query and selecting the type of join that includes
all records from the master table and any matching records
from the query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top