Query for chart

C

carlos

Hi,

I have created a chart from chart wizard and modified it a
bit in the SQL design.
TRANSFORM Count(tblCAR.CAR) AS CountOfCAR
SELECT tblCAR.Owner
FROM tblCAR
GROUP BY tblCAR.Owner
PIVOT IIf([SignOffDate] Is Null,'Outstanding','Closed');

I want to present the bar chart in DESCENDING order by
CountOfCAR.

Any help, please advise. Thanks in advance.

Carlos
 
D

Duane Hookom

SELECT Owner, Sum(Abs(IsNull(SignOffDate))) As Outstanding,
Sum(IsNull(SignOffDate)+1) As Closed
FROM tblCar
GROUP BY Owner
ORDER BY Sum(Abs(IsNull(SignOffDate)));
 
C

carlos

Dear Duane

Excellent! I'm poor in math, explanation would be much
appreciated if you have spare time.

Thanks a lot.

Carlos
-----Original Message-----
SELECT Owner, Sum(Abs(IsNull(SignOffDate))) As Outstanding,
Sum(IsNull(SignOffDate)+1) As Closed
FROM tblCar
GROUP BY Owner
ORDER BY Sum(Abs(IsNull(SignOffDate)));

--
Duane Hookom
MS Access MVP


Hi,

I have created a chart from chart wizard and modified it a
bit in the SQL design.
TRANSFORM Count(tblCAR.CAR) AS CountOfCAR
SELECT tblCAR.Owner
FROM tblCAR
GROUP BY tblCAR.Owner
PIVOT IIf([SignOffDate] Is Null,'Outstanding','Closed');

I want to present the bar chart in DESCENDING order by
CountOfCAR.

Any help, please advise. Thanks in advance.

Carlos


.
 
D

Duane Hookom

IsNull(SignOffDate) returns -1 for Null values and 0 for non-null values.
This suggests that summing the value is similar to counting specific values.

--
Duane Hookom
MS Access MVP


carlos said:
Dear Duane

Excellent! I'm poor in math, explanation would be much
appreciated if you have spare time.

Thanks a lot.

Carlos
-----Original Message-----
SELECT Owner, Sum(Abs(IsNull(SignOffDate))) As Outstanding,
Sum(IsNull(SignOffDate)+1) As Closed
FROM tblCar
GROUP BY Owner
ORDER BY Sum(Abs(IsNull(SignOffDate)));

--
Duane Hookom
MS Access MVP


Hi,

I have created a chart from chart wizard and modified it a
bit in the SQL design.
TRANSFORM Count(tblCAR.CAR) AS CountOfCAR
SELECT tblCAR.Owner
FROM tblCAR
GROUP BY tblCAR.Owner
PIVOT IIf([SignOffDate] Is Null,'Outstanding','Closed');

I want to present the bar chart in DESCENDING order by
CountOfCAR.

Any help, please advise. Thanks in advance.

Carlos


.
 

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