Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need help with SQL string!

Author  Topic 

kHebTrekInWatLekkers
Starting Member

3 Posts

Posted - 2001-08-14 : 03:44:32
I have the next tabble:

No: Name: LastPayDate DayPayed:
01 Piet 30-01-2001 15-01-2001
02 Piet 28-02-2001 11-02-2001
03 Piet 30-03-2001 18-03-2001
04 Piet 30-04-2001 17-04-2001
05 Piet 30-05-2001 04-06-2001
06 Piet 30-06-2001
07 Henk 30-01-2001 15-01-2001
08 Henk 28-02-2001 11-02-2001
09 Henk 30-03-2001 12-04-2001

Now I want with a SQL string to get the next recordset: Name, NumberPayed, TooLate:

Name: NumberPayed: TooLate:
Piet 5 1
Henk 3 1

To get NumberPayed is no problem.
That is Count(DayPayed), and it needs to be grouped by name. My probles is that I do not know I can calculate TooLate.
Is it possible to use an expression on the Count function for example Count(DayPayed-LastPayDate when < 0)???????
If somebody can help me out..... Thank you...




Edited by - kHebTrekInWatLekkers on 08/14/2001 03:48:59
   

- Advertisement -