Odd, after stripping out bits and starting again, I find this one DOES work.  : But it still leaves me with the question of “why didn’t the first one work”?

 

SELECT MAX(HR.DATEREVIEWED), H.SHORTNOTES, H.COMPANYID

FROM  HAZARDREVIEW HR

JOIN HAZARD H ON H.HAZARDID = HR.HAZARDID

WHERE (EXTRACT(MONTH FROM HR.DATEREVIEWED) = EXTRACT(MONTH FROM CAST('TODAY' AS DATE))+1)

AND  (EXTRACT(YEAR FROM HR.DATEREVIEWED) = EXTRACT(YEAR FROM CAST('TODAY' AS DATE))-1)

 

GROUP BY COMPANYID, SHORTNOTES

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul McKenzie
Sent: Tuesday, 10 August 2004 3:55 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] (interbase) extract(month from datefield)

 

I think from memory you have to do this as a sub-select...

 

HTH

 

Regards
Paul McKenzie
SMSS Ltd.
Wellington
New Zealand

----- Original Message -----

From: tracey

Sent: Tuesday, August 10, 2004 3:42 PM

Subject: [DUG] (interbase) extract(month from datefield)

 

Could someone tell me what is wrong with this query please??

 

select h.shortnotes, h.notificationdate, max(hr.datereviewed)

from hazard h

left join hazardreview hr on h.hazardid = hr.hazardid

where h.companyid = 9

and (extract(month from hr.datereviewed) = 7)

group by h.notificationdate, h.shortnotes

 

I get an error:

_expression_ evaluation not supported


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to