How do I get the amount of the oldest transaction using the transaction date on both SQL Server and Cognos -
i tried getting result 2834.0000 using oldest date 2010-08-31 13:51:02.000 end getting dates , corresponding amount. need 1 row , 1 column. how do in sql server , in cognos report studio using data item?
select min([transaction date]) [transaction date], [gwp amt] [amount] dw.amounttable [policy number] = '11eeo7030500' group [transaction date], [gwp amt]
for starters, lose [transaction date] in group clause, you're getting min([transaction date]) in select clause , not grouping on it.
but if want 1 row min(transactiondate)and row's amount, couple of ways pull off, try 1 first..
select [transaction date], amount dw.amounttable [transaction date] in (select min([transaction date]) dw.amounttable)
Comments
Post a Comment