Order by in query (1 Viewer)

radek225

Registered User.
Local time
Today, 11:57
Joined
Apr 4, 2013
Messages
307
I have a query with "order by LP asc" (lp is a number) but the problem is when the lp is null (has no value) then these rows are on top. What should I do to have rows with no value at the bottom?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:57
Joined
Feb 19, 2013
Messages
16,649
try order by nz(LP,1000000)

make the number as big as it needs to be to be the biggest
 

plog

Banishment Pending
Local time
Today, 13:57
Joined
May 11, 2011
Messages
11,662
ORDER BY NZ(LP, 999999)

If you have LP values greater than 999999, use a value greater than your largest LP value.
 

plog

Banishment Pending
Local time
Today, 13:57
Joined
May 11, 2011
Messages
11,662
Damn it CJ, that's twice today. I'm getting closer though, this time I was only a minute behind.
 

Users who are viewing this thread

Top Bottom