Wow, this is real magic happening(;
No, seriously - thank you very much; I wouldn't have come up with the idea, but it works like a charm and now after I've seen how it can be done.. of course I feel stupid, like all the time when something like that happens*g*
Anyway; you made my day - now I don't have to cumulate the data in a cronjob, just to work around my unworthy MSSQL skills..
Thanks again and have...
User Profile
Collapse
-
Cumulating data
Hi there,
The following statement cumulates all scanned invoices from a given day:
"SELECT CONVERT(char(10 ), SCANDATE, 102) AS Scandate, COUNT(CONVERT(c har(10), SCANDATE, 102)) AS Number_of_scann ed_invoices
FROM invoices
WHERE (Scandate IS NOT NULL) AND
(Scandate BETWEEN '" + from + "' AND '" + until_ +
"') GROUP BY CONVERT(char(10 ), SCANDATE,... -
I have found my solution; I actually did use MIN() as suggested:
SELECT CREDITOR_NAME, CREDITOR_NO, MIN(INV_ID), COUNT(CREDITOR_ NO) as no_of_inv
FROM DIPPMX.ADMIN.TI $ST_RECO
GROUP BY CREDITOR_NAME, CREDITOR_NO
HAVING COUNT(CREDITOR_ NO) >= 3Leave a comment:
-
unique values combined with COUNT()
Hi there,
The following statement produces multiple results, but I only need one.
SELECT CREDITOR_NAME, CREDITOR_NO, INV_ID, TRAIN_COUNT, COUNT(CREDITOR_ NO) as number_of_inv
FROM DIPPMX.ADMIN.TI $ST_RECO
GROUP BY CREDITOR_NAME, INV_ID, TRAIN_COUNT, CREDITOR_NO
HAVING COUNT(CREDITOR_ NO) >= 5
Normally I would include the CREDITOR_NAME...
No activity results to display
Show More
Leave a comment: