Re: Query help needed (JOIN)

From: Laconic2 <laconic2_at_comcast.net>
Date: Wed, 25 Aug 2004 10:18:19 -0400
Message-ID: <RtCdnZPZI-a5ArHcRVn-pQ_at_comcast.com>


"Adam Nemitoff" <adamn_at_TeamNemitoff.com> wrote in message news:1500ba9f.0408250518.3ab93325_at_posting.google.com...

> I have tried to create a query with an INNER JOIN where the value for
> the StateID output field comes from the last row in the StateTable
> WHERE StateTable.TimeStep <= EventTable.TimeStep and where I use a
> GROUP_BY EventTable.ID to merge the following rows from the join:

Could you define more precisely what you mean by "last"? I think I understand, but I want to be sure.
This could be related to your problem. I note that, as far as equijoins go, the two tables you show are disjoint, unless I've misread something.

Also, it would be easier to comment on your query if you posted it as written, rather than summarizing it.

> I also think that the queries I have written is slow and inefficient.
> Is there a better way to perform this query or is my database design
> fatally flawed?

Of the queries that produce wrong results, don't worry about which ones are fast and which ones are slower. Only once you get several queries that all produce correct results should you begin noting which ones are fast or slow. Received on Wed Aug 25 2004 - 16:18:19 CEST

Original text of this message