I have a file [a/r trans]. I counting RT (round trip) and OW (one way), based on a start-end date range.
This is my query:
SELECT Month([end date]) AS emonth, [a/r trans]!private AS private1, Format([end date],"mmmm yyyy") AS [month], nz([a/r trans].insrcd,"") AS insrcd, [a/r trans].cp AS transp, Sum([a/r trans].[days attended]) AS days, [a/r trans].type, IIf(([a/r trans].cp>10 And [a/r trans].type="I"),Sum([a/r trans]![end date]-[a/r trans]![start date]+1)) AS rt, IIf(([a/r trans].cp>0 And [a/r trans].cp<11 And [a/r trans].type="I"),Sum(([a/r trans]![end date]-[a/r trans]![start date]+1))) AS ow
FROM [a/r trans]
WHERE ((([a/r trans].[start date]) Between [Forms]![ar yearly]![pid from] And [Forms]![ar yearly]![pid to]) AND (([a/r trans].cp)>0) AND (([a/r trans].type)="I") AND (([a/r trans].amount)<>0))
GROUP BY Month([end date]), [a/r trans]!private, Format([end date],"mmmm yyyy"), [a/r trans].cp, [a/r trans].type, [a/r trans].insrcd
ORDER BY Month([end date]), [a/r trans].insrcd, [a/r trans].cp, [a/r trans].type;
Posted by: sarahk@schemesoftware.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar