webForumDet fria alternativet

ORDER BY MSSQL

1 svar · 417 visningar · startad av budg1e

budg1eMedlem sedan apr. 2005117 inlägg
#1

Jag använde följande kod i en Access databas

"' ORDER BY Klass ASC, " & _
" H_Kat ASC, " & _
" IIF(Avd IS NULL OR Avd = '', 0, 1), " & _
" IIF(T_fel2 IS NULL, 1, 0), T_fel2 ASC, " & _
" IIF(T_tid2 IS NULL OR T_tid2 = '', 1, 0), T_tid2 ASC, " & _
" IIF(T_fel1 IS NULL, 1, 0), T_fel1 ASC, " & _
" IIF(T_tid1 IS NULL OR T_tid1 = '', 1, 0), T_tid1 ASC "

Försöker få samma resultat med en MSSQL-databas med denna kod

"' ORDER BY Klass ASC, " & _
" H_Kat ASC, " & _
" case when Avd is null OR Avd = '' then 0 else 1 end, " & _
" case when T_fel2 is null then 1 else 0 end, " & _
" case when T_tid2 is null or T_tid2 <> '' then 1 else 0 end, " & _
" case when T_fel1 is null then 1 else 0 end, " & _
" case when T_tid1 is null or T_tid1 <> '' then 1 else 0 end "

Men det stämmer inte, jag får ett annat resultat. Någon som kan se vad jag gjort för fel?

Det fungerar nu med följande kod

"' ORDER BY Klass ASC, " & _
" H_Kat ASC, " & _
" case when Avd is null OR Avd = '' then 0 else 1 end, " & _
" case when T_fel2 is null then 1 else 0 end, T_fel2 ASC, " & _
" case when T_tid2 is null OR T_tid2 <> '' then 1 else 0 end, T_tid2 ASC, " &_
" case when T_fel1 is null then 1 else 0 end, T_fel1 ASC,  " & _
" case when T_tid1 is null OR T_tid1 <> '' then 1 else 0 end, T_tid1 ASC "
budg1eMedlem sedan apr. 2005117 inlägg
#2

Hittade felet...

124 ms totalt · 3 externa anrop · cache AV · v20260731051352-full.56cc9887
0 ms — hämta statistik (cache)
0 ms — hämta forumlista (cache)
122 ms — hämta tråd, inlägg och bilagor (db)