I have two tables. I want to write a SQL statement which combines info from both. I'm having trouble.
Table 1 fields:
1. ID
2. Name
3. Stat_1
4. TimeStamp
Table 2 fields:
1. ID
2. Stat_2
3. Stat_3
4. TimeStamp
Table 1 will have one record per ID per TimeStamp. Table 2 may have multiple identical TimeStamps per ID. Table 2 may also have zero records corresponding to the timestamp in Table 1. I am trying to get a query to output:
1. ID
2. TimeStamp
3. Stat_1
4. Sum(Stat_2)
5. Sum(Stat_3)
If there is no record in Table 2, I want #4 & 5 to be zero.
Thanks for any help
Table 1 fields:
1. ID
2. Name
3. Stat_1
4. TimeStamp
Table 2 fields:
1. ID
2. Stat_2
3. Stat_3
4. TimeStamp
Table 1 will have one record per ID per TimeStamp. Table 2 may have multiple identical TimeStamps per ID. Table 2 may also have zero records corresponding to the timestamp in Table 1. I am trying to get a query to output:
1. ID
2. TimeStamp
3. Stat_1
4. Sum(Stat_2)
5. Sum(Stat_3)
If there is no record in Table 2, I want #4 & 5 to be zero.
Thanks for any help