G
Guest
Hi
I've struggled with this but my SQL is not up to it. So any help would be
appreciated. Yes I can do it in a number of steps but that's not very
elegant; I have a feeling it could be done in one complex(?) SQL.
There are two related tables. The first is an Item table and the second is a
Transaction table that contains the Item PK as a foreign key as well as a
transaction date. For any item there are zero to many transactions. It's all
standard stuff so far.
Now I wish to retrieve the item data concatenated with the transaction data
for any given (parameter) date. It's still standard stuff but here's the
rub. If there are no transactions for the item for that day I still want the
SQL to return the item data with a blank/null/zero transaction data stub.
If you're wondering about the business logic then let me say that there can
be only one transaction per day for each item, the system takes care of this.
Thus what I want is a list of all items together with the transaction data
for the specified day or no data if there is no transaction for that day.
Can this be done in one step?
Rod
I've struggled with this but my SQL is not up to it. So any help would be
appreciated. Yes I can do it in a number of steps but that's not very
elegant; I have a feeling it could be done in one complex(?) SQL.
There are two related tables. The first is an Item table and the second is a
Transaction table that contains the Item PK as a foreign key as well as a
transaction date. For any item there are zero to many transactions. It's all
standard stuff so far.
Now I wish to retrieve the item data concatenated with the transaction data
for any given (parameter) date. It's still standard stuff but here's the
rub. If there are no transactions for the item for that day I still want the
SQL to return the item data with a blank/null/zero transaction data stub.
If you're wondering about the business logic then let me say that there can
be only one transaction per day for each item, the system takes care of this.
Thus what I want is a list of all items together with the transaction data
for the specified day or no data if there is no transaction for that day.
Can this be done in one step?
Rod