RCheesley
Registered User.
- Local time
- Today, 01:51
- Joined
- Aug 12, 2008
- Messages
- 243
Hi all,
I'm having trouble with a query when in pivot chart view, as it is sorting the dates wrongly:
yyyy ww
2009 1
2009 10
2009 11
when I want it to display as:
2009 1
2009 2
2009 3
and so forth.
I've got as far as identifying that I may need it to sort as "CInt" rather than a string (which someone told me) but that might as well be double dutch to me .... I've tried searching but am not coming up with anything useful.
The SQL behind the query is as follows (I've put some line breaks in for ease of reading):
Anyone able to point me in the right direction?
I'm having trouble with a query when in pivot chart view, as it is sorting the dates wrongly:
yyyy ww
2009 1
2009 10
2009 11
when I want it to display as:
2009 1
2009 2
2009 3
and so forth.
I've got as far as identifying that I may need it to sort as "CInt" rather than a string (which someone told me) but that might as well be double dutch to me .... I've tried searching but am not coming up with anything useful.
The SQL behind the query is as follows (I've put some line breaks in for ease of reading):
Code:
SELECT DISTINCTROW Format$([tblSpecimen].[SpecimenDate],'yyyy ww')
AS [SpecimenDate By Week], tblOrganism.OrganismAbbreviation, tblSpecimen.SpecimenLocation, tblHospital.HospitalCode, Count(*) AS [Count Of tblSpecimen], Location(Nz([SpecimenDate],0),Nz([SpecimenCurrentAdmission],0)) AS Loc, tblPatientDetails.PatientDetailsGP
FROM (tblPatientDetails INNER JOIN (tblHospital INNER JOIN tblSpecimen ON tblHospital.HospitalID = tblSpecimen.SpecimenLocation) ON tblPatientDetails.PatientDetailsID = tblSpecimen.PatientDetailsID) INNER JOIN tblOrganism ON tblSpecimen.SpecimenOrganism = tblOrganism.OrganismID
GROUP BY Format$([tblSpecimen].[SpecimenDate],'yyyy ww'), tblOrganism.OrganismAbbreviation, tblSpecimen.SpecimenLocation, tblHospital.HospitalCode, Location(Nz([SpecimenDate],0),Nz([SpecimenCurrentAdmission],0)), tblPatientDetails.PatientDetailsGP, tblSpecimen.SpecimenOrganism, Year(tblSpecimen.SpecimenDate)*12+DatePart('m',tblSpecimen.SpecimenDate)-1
HAVING (((tblPatientDetails.PatientDetailsGP)<69));
Anyone able to point me in the right direction?