Cross tab query

M

MN

Hi - I have this query below, but the data do not have First quarter, so how
can I list them on the report? Thank you for any reply.

Query come out with the result like this:
County Countyname Q2 Q3 Q4

TRANSFORM Count([client].[county]) AS CountOfCountycode
SELECT [client].[county], [CountyCode].[Countyname]
FROM client INNER JOIN CountyCode ON [client].[county]=[CountyCode].[Cntycode]
GROUP BY [client].[county], [CountyCode].[Countyname]
PIVOT "Q" & Format([cln_cls_dt],"q");
 
K

KARL DEWEY

Change to --
PIVOT "Q" & Format([cln_cls_dt],"q") IN("Q1", "Q2", "Q3", "Q4");
 
M

MN

Thank you
KARL DEWEY said:
Change to --
PIVOT "Q" & Format([cln_cls_dt],"q") IN("Q1", "Q2", "Q3", "Q4");

--
Build a little, test a little.


MN said:
Hi - I have this query below, but the data do not have First quarter, so how
can I list them on the report? Thank you for any reply.

Query come out with the result like this:
County Countyname Q2 Q3 Q4

TRANSFORM Count([client].[county]) AS CountOfCountycode
SELECT [client].[county], [CountyCode].[Countyname]
FROM client INNER JOIN CountyCode ON [client].[county]=[CountyCode].[Cntycode]
GROUP BY [client].[county], [CountyCode].[Countyname]
PIVOT "Q" & Format([cln_cls_dt],"q");
 
M

MN

Uh... I got an error :"Can't specify fixed column heading 'Q4' in a crosstab
query more than once." Thanks .

KARL DEWEY said:
Change to --
PIVOT "Q" & Format([cln_cls_dt],"q") IN("Q1", "Q2", "Q3", "Q4");

--
Build a little, test a little.


MN said:
Hi - I have this query below, but the data do not have First quarter, so how
can I list them on the report? Thank you for any reply.

Query come out with the result like this:
County Countyname Q2 Q3 Q4

TRANSFORM Count([client].[county]) AS CountOfCountycode
SELECT [client].[county], [CountyCode].[Countyname]
FROM client INNER JOIN CountyCode ON [client].[county]=[CountyCode].[Cntycode]
GROUP BY [client].[county], [CountyCode].[Countyname]
PIVOT "Q" & Format([cln_cls_dt],"q");
 
K

KARL DEWEY

Did you?

Post back your complete SQL.

--
Build a little, test a little.


MN said:
Uh... I got an error :"Can't specify fixed column heading 'Q4' in a crosstab
query more than once." Thanks .

KARL DEWEY said:
Change to --
PIVOT "Q" & Format([cln_cls_dt],"q") IN("Q1", "Q2", "Q3", "Q4");

--
Build a little, test a little.


MN said:
Hi - I have this query below, but the data do not have First quarter, so how
can I list them on the report? Thank you for any reply.

Query come out with the result like this:
County Countyname Q2 Q3 Q4

TRANSFORM Count([client].[county]) AS CountOfCountycode
SELECT [client].[county], [CountyCode].[Countyname]
FROM client INNER JOIN CountyCode ON [client].[county]=[CountyCode].[Cntycode]
GROUP BY [client].[county], [CountyCode].[Countyname]
PIVOT "Q" & Format([cln_cls_dt],"q");
 
M

MN

Huh ... So sorry ... It working now. I do not know why I got an err before?
I delete the query and working from the begin then it work!?

Sorry for any confusion-Regards,
MN

KARL DEWEY said:
Did you?

Post back your complete SQL.

--
Build a little, test a little.


MN said:
Uh... I got an error :"Can't specify fixed column heading 'Q4' in a crosstab
query more than once." Thanks .

KARL DEWEY said:
Change to --
PIVOT "Q" & Format([cln_cls_dt],"q") IN("Q1", "Q2", "Q3", "Q4");

--
Build a little, test a little.


:

Hi - I have this query below, but the data do not have First quarter, so how
can I list them on the report? Thank you for any reply.

Query come out with the result like this:
County Countyname Q2 Q3 Q4

TRANSFORM Count([client].[county]) AS CountOfCountycode
SELECT [client].[county], [CountyCode].[Countyname]
FROM client INNER JOIN CountyCode ON [client].[county]=[CountyCode].[Cntycode]
GROUP BY [client].[county], [CountyCode].[Countyname]
PIVOT "Q" & Format([cln_cls_dt],"q");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top