FROM YourTable
GROUP BY [Code]
PIVOT IIf([Number]>500,"Over 500",IIf([Number]>100,"Over 100",IIf
([Number]>25,"Over 25","Under 25")))
Groeten,
Peterhttp://access.xps350.com-Hidequotedtext -
- Show quoted text -
Thanks, i will look into cross-tab queries and get back to you if i
get stuck again.
Appreciate it guys, cheers.- Hide quoted text -
- Show quoted text -[/QUOTE][/QUOTE]
[QUOTE]
I think i am getting there with the cross-tab query - can you help me
to refine it, i have:[/QUOTE]
[QUOTE]
TRANSFORM Sum([tblData].[Amount]) AS SumOfAmount
SELECT [tblData].[LoggedDate]
FROM tblData
GROUP BY format([tblData].[LoggedDate],"mmm yy")
PIVOT ([tblData].[Amount] In (>=50000,between 49999 and
10000,<100000);[/QUOTE]
[QUOTE]
I am trying to group the amounts, by month into
- Above £50,000
- Between £10,000 and £49,999
- Less than £10,000[/QUOTE]
[QUOTE]
Can anyone help?[/QUOTE]
[QUOTE]
Thanks in advance.- Hide quoted text -[/QUOTE]
[QUOTE]
- Show quoted text -[/QUOTE]
Sorry, i used some of Peters (XPS350) suggestion, and came up with:
TRANSFORM Sum([tblData].[Amount]) AS SumOfAmount
SELECT [tblData].[LoggedDate]
FROM tblData
GROUP BY format([tblData].[LoggedDate],"mmm yy")
PIVOT IIf([Amount]>500,"Over 500",IIf([Amount]>100,"Over 100",IIf
([Amount]>25,"Over 25","Under 25")))
But, access is telling me "You tried to execute a query that does not
include the specified expression "LoggedDate" as part of an aggregate
function."- Hide quoted text -
- Show quoted text -[/QUOTE]
I realise that im just spamming this - unintentionally - but i have
the solution.
Using the help provided here, and just trial and error :
TRANSFORM Count(tblData.Amount) AS CountOfAmount
SELECT Format([tblData].[LoggedDate],"mmm yy") AS [Month]
FROM tblData
GROUP BY Format([tblData].[LoggedDate],"mmm yy"), Year([LoggedDate]),
Month([LoggedDate])
ORDER BY Year([LoggedDate]), Month([LoggedDate])
PIVOT IIf([Amount] >50000,"Over £50000",IIf([Amount]>10000,"Over
£10000",IIf([Amount]>2500,"Over £2500","Under £2500")));
Thanks everyone :)