|
Search
You searched for the word(s):
Showing page 5 of 7 (62 total posts)
< 1 second(s)
-
Deoarece am cam multe variante am adoptat varianta cu un tabel separat.Va multumesc ptr. raspunsuri
-
Ma gandeam sa nu mai fie nevoie de inca un tabel
-
Cum pot sa fac urmatorul select (acum da eroare)SELECT * from tabelWHERE utilizator INCASEWHEN USER_NAME() = 'user1' THEN ('user1', 'user2')WHEN USER_NAME() = 'user3' THEN ('user3', 'user2')DEFAULT USER_NAME()ENDSe poate ?
-
eu intr-adevar am nevoie de exact match dar avand in vedere ca @comp are intotdeauna 2 caractere nu mai am nevoie de '%'.Chestia este ca merge mai repede cu LIKE (acum foloseste un Index Seek in loc de Scan).Multumesc ptr. raspunsuri.
-
ssandu:substring(t1.cod,1,2) = @comp inlocuit cu LIKE @comp reduce timpul sub o secunda.
-
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 grupafrom tabel t1 join tmp on t1.pk_key = tmp.pk_keywhere t1.sold <> 0 and substring(t1.cod,1,2) = @comporder by cod
-
ignatandrei:Ai putea, deci , sa optimizezi index scan ... sa il transformi intr-un seek.Poti sa-mi explici cum sa fac asta ?
-
Sunt aproximativ 300000 de inregistrari.Indecsi sunt pe tabel (este vorba de un singur tabel) : cod, data, cod+data, pk_key (primar. clustered)Numai daca nu gasesc o alta solutie o sa mai fac 2 campuri.In execution plan am un Index Scan de 74% pe indexul primar (pk_key) pentru expresia SUBSTRING(cod,1,2)=@comp si un Index Seek pe ...
-
SalutAm o tabela pk_key(int), cod(char),sold(numeric),
data(smalldatetime) din care sa extrag ultimele inregistrari la o
anumita data la care soldul sa fie diferit de 0.Selectul pe care il am acum esteSELECT cod, sold, SUBSTRING(cod,3,4) as grupa FROM tabel t1WHERE sold <> 0 and SUBSTRING(cod,1,2) = @comp and pk_key = (SELECT ...
-
SalutAm o tabela pk_key(int), cod(char),sold(numeric), data(smalldatetime) din care sa extrag ultimele inregistrari la o anumita data la care soldul sa fie diferit de 0.Selectul pe care il am acum esteSELECT cod, sold, SUBSTRING(cod,3,4) as grupa FROM tabel t1WHERE sold <> 0 and SUBSTRING(cod,1,2) = @comp and pk_key = (SELECT MAX(pk_key) as ...
... 5
|
|
|