Subject | Re: Subquery Question (FB 1.5) |
---|---|
Author | data.inspector |
Post date | 2010-07-07T13:36:38Z |
Here are the two peices of the query I can't get tied together.
Thanks for looking at it.
select
watlev.inventory_pk,
watlev.wl_date,
watlev.wl_comment
from
watlev
where
/*It is this piece of the SQL Statement I can't seem to puzzle out */
(select
w.inventory_pk,
max( w.wl_date ) max_of_wl_date
from watlev w
group by w.inventory_pk)
Thanks for looking at it.
select
watlev.inventory_pk,
watlev.wl_date,
watlev.wl_comment
from
watlev
where
/*It is this piece of the SQL Statement I can't seem to puzzle out */
(select
w.inventory_pk,
max( w.wl_date ) max_of_wl_date
from watlev w
group by w.inventory_pk)
--- In firebird-support@yahoogroups.com, <willy.bojit@...> wrote:
>
> Hi
>
> Show us the query.
>
> --- On Wed, 7/7/10, data.inspector <data.inspector@...> wrote:
>
> From: data.inspector <data.inspector@...>
> Subject: [firebird-support] Subquery Question (FB 1.5)
> To: firebird-support@yahoogroups.com
> Date: Wednesday, 7 July, 2010, 4:13
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> I have a table with three columns "Well ID" "Date" and "Comment". I am trying to find the most recent "Comment" for each "Well ID" using a subquery that retrieves the "Well ID" and Max ("Date"). My subquery gets the Well ID and the max date, but I just can't figure out how to use that information to get the "Comment" based on those results. I am using some books on SQL as a guide, but I'm never sure if I have the syntax wrong, or if Firebird 1.5 doesn't support the same syntax.
>
>
>
> Is there a good resource out there that describes these sorts of queries?
>
>
>
>
>
>
>
>
>
> _,_._,___
>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>