My SQL knowledge is a little rusty. While I can write simple queries, I have a complicated one that is giving me a headache. Any help?
I'm using the following tables (only showing the relevant fields)...
Test table
- TestID (pk)
- TestDesc
FAC table
- TestID (fk, Test)
- Modified (Date/Time)
* pk(TestID, Modified)
Results table
- SerialNo
- TestCount
* pk(SerialNo, TestCount)
- TestDateTime
- TestID
I need to write a query that shows the following:
1. Each TestID and corresponding TestDesc
2. The most recent Modified date from the FAC table for each TestID
3. The number of SerialNos in the Results table that have a TestDateTime after the Modified date in #2, for each TestID
I can write queries through joins to get 2, and 3 without the Modified data restriction, but it's tying it all together in one SELECT statement that's getting me confused.
Thanks