chpicker
Programmer
- Apr 10, 2001
- 1,316
I am still having fun trying to figure out how to properly construct an SQL statement to pull up the data I want. I've figured out a few of them, but there are still things I'm unsure of. Take this example:
2 tables, one contains Orders, the other contains Orderitems. Each item in Orderitems has a numeric Manifest which corresponds to the same field in Orders. Both tables are indexed by Manifest, but in Orders it is the Primary key.
I want to construct a SELECT statement that will give me one record per Manifest from Orders in a given date range with a COUNT of the number of matching records in Orderitems. I can't figure it out.
To go a step further, I want to construct another SELECT statement that gives me one record per Manifest from Orders in a given date range (as above), but the COUNT of matching Orderitems should ONLY reflect items that are on backorder (logical field in Orderitems).
Can anyone help me figure these out? Also, could anyone point me to a good online SQL reference?
2 tables, one contains Orders, the other contains Orderitems. Each item in Orderitems has a numeric Manifest which corresponds to the same field in Orders. Both tables are indexed by Manifest, but in Orders it is the Primary key.
I want to construct a SELECT statement that will give me one record per Manifest from Orders in a given date range with a COUNT of the number of matching records in Orderitems. I can't figure it out.
To go a step further, I want to construct another SELECT statement that gives me one record per Manifest from Orders in a given date range (as above), but the COUNT of matching Orderitems should ONLY reflect items that are on backorder (logical field in Orderitems).
Can anyone help me figure these out? Also, could anyone point me to a good online SQL reference?