Re: Help with queries - Top N by Group, and Query using 'IN'

Tech-Archive recommends: Speed Up your PC by fixing your registry



For query 2 please supply sample data as well as expected output.

Here is a guess:
SELECT
sd.[server],
sd.[date],
sd.[data]
FROM
tbl_server_data sd
INNER JOIN (
SELECT
[server],
max(date) dt
FROM
tbl_server_data_old
GROUP BY
[server]) so
ON so.[server] = sd.[server]
AND so.[dt] = sd.[date]


On Aug 13, 4:15 pm, Benjamin <benjamin.dizenho...@xxxxxxxxx> wrote:
Thank you very much for the quick reply.

We are using SQL Server 2005 (to the best of my knowledge), and will
test your solution to query type 1.

As for your answer to query type 2, I guess my sample query wasn't
very informative. We need to use the 'IN' clause due to the subquery
actually makes use of the MAX function. I probably should have
included it. A better sample query would be:
select server, date, data ....
from tbl_server_data inner join other_tables_to_join....
where (server, date) IN
(select server, max(date) as date from
tbl_server_data_old group by server)

Again, thanks for any and all help


.



Relevant Pages

  • Re: MailMerge hangs and crashes with Access on Server
    ... Since I am fairly new to working in this environment, I am not sure what you mean by an "Access group" with help to restructuring the query? ... "Peter Jamieson" wrote: ... All I know is that the performance of queries depends to a large extent on whether, for example, a join is performed on the client side, or on the server side, incurring no network traffic and potentially benefitting from caching on the server. ... There are no dialog boxes, and actually, I have now split the database, and have kept the Word templates and the Access frontend locally on my machine, and moved the backend to the server. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Performance Benchmarks?
    ... Are attribute relationships defined properly on the dimensions? ... If you run Profiler against the server, how long is spent in "Query ... I have created aggregations (Partitions tab in cube design). ...
    (microsoft.public.sqlserver.olap)
  • High CPU in client (Excel, OWC, Proclarity, etc.) accessing Analysis Services
    ... the OWC10 with 3 dimensions on the row axis, ... The largest size of any of these 4 dimensions < 360 members. ... Performance Guide to optimize the query, the cube, the server, etc. ...
    (microsoft.public.sqlserver.olap)
  • Re: Performance Benchmarks?
    ... adding memory on the server can help you; more data can be cached on the ... Here is my test query. ... )} DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ... I have created aggregations (Partitions tab in cube design). ...
    (microsoft.public.sqlserver.olap)
  • Re: MailMerge hangs and crashes with Access on Server
    ... restructuring a complex query. ... discards 99% of them), or on the server side, incurring no network ... the database is locked and Word will not open the data source. ... have kept the Word templates and the Access frontend locally on my machine, ...
    (microsoft.public.word.mailmerge.fields)