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] 

enter image description here

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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -