Welcome to Sign in | Help

Re: Select ultimele valori

  •  04-16-2008, 3:22 PM

    Re: Select ultimele valori

    Am reusit pana la urma sa reduc la 3 sec
    with tmp(pk_key, cod)
    As
    (
        select max(pk_key) as pk_key cod from tabel where data <= @data group by cod
    )
    select pk_key, cod, sold, substring(cod,3,4) as grupa
    from tabel t1 join tmp on t1.pk_key = tmp.pk_key
    where t1.sold <> 0 and substring(t1.cod,1,2) = @comp
    order by cod

    Sorin Sandu
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems