N
nickh
I have a one-to-many database, with the parent record holding the business
name, phone, address, etc. The child database contains multiple activity
records that are timestamped each instance a communication is made with the
company. The child records have phone as the foreign key linking back to the
parent, datestamp, result, and notes. I want to write a SQL query (hopefully
1 single query), that will return the business name & phone from the parent
record, along with the datestamp, result, and notes from the linked child
record but only for the last activity record (i.e., the activity record with
the latest datestamp). I cannot figure out how to do this!! Do I use the
Last aggregation function? A subquery and top 1 with descending order?
Help!! This is driving me crazy!
name, phone, address, etc. The child database contains multiple activity
records that are timestamped each instance a communication is made with the
company. The child records have phone as the foreign key linking back to the
parent, datestamp, result, and notes. I want to write a SQL query (hopefully
1 single query), that will return the business name & phone from the parent
record, along with the datestamp, result, and notes from the linked child
record but only for the last activity record (i.e., the activity record with
the latest datestamp). I cannot figure out how to do this!! Do I use the
Last aggregation function? A subquery and top 1 with descending order?
Help!! This is driving me crazy!