Hi All;

I recieved an e-mail as part of a PHP user group mailing list, does anyone
know the answer?

----cut here----

Ok, I know that you can do a ( ) in a query for working stuff but can you do
another query there? ie

select * from "Activity"
join
(
 select "License Number", max("Activity Date") from
 "Activity"
 where
  "Agency" = 'OGC' and
  "Posted" >= '2003-01-01'
  and (
    "Activity" = 'RIG RELEASED' or
    "Activity" = 'RESUMED' or
    "Activity" = 'SUSPENDED' or
    "Activity" = 'CANCELLED' or
    "Activity" = 'DRILLING' or
    "Activity" = 'PREP TO SPUD'
  )
 group by "License Number"
 having max("Activity Date") >= '2003-01-01'
) AS T1
ON
"Activity"."License Number" = "T1"."License Number" and
"Activity"."Activity Date" = "T1"."Activity Date"

----cut here----

Any help would be appreciated.

Thanks,
Mike Hillyer
http://www.dynamergy.com/mike


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to