General information
Category:
Coding, syntax & commands
Dear all,
I have a table with below data:
Dcode – Pcode – Payment – Discount
1 - 1 - 10000 - 0
1 - 1 - 40000 - 0
1 - 1 - 20000 - 1000
1 - 2 - 30000 - 0
I want to write a SQL that make a cursor as below
Dcode – pcode – payment – DisNum – UnDisNum
1 - 1 - 70000 - 1 – 2
1 - 2 - 30000 - 0 - 1
Here is my SQL
Select Main.DCode, Main.PCode, SUM(Payment) ;
From Main ;
Group by Main.DCode,Main.PCode ;
Into cursor TempCrs Readwrite
But I don’t know how I can count num of records that their Discount is empty and num of records that their Discount is not empty.
Can I do this in one SQL statement ?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only