Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

sorting and order by with nulls on the bottom after executing query

excel sql vba..

Is there a way in sql in vba to make nulls go to the bottom of the query instead of the top.

i found plety of examples but none seem to work?

for vba...

How does one use the "SWITCH" clause that includes sql with "where" statements and 3 fields to sort by ?
ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Confused.  What SQL? Excel as topic, VBA as discussion.

If you executing an SQL query into a dbms such as SQL Server or Oracle please provide the query and we can make recommendations. It might involve using a case expression similar to the IIF shown above e.g.

order by CASE WHEN x IS NULL THEN 'zzzzzzzzzzz' ELSE x END, ....

- but there may be other opportunities depending on the query itself and the dbms being used. (e.g. Oracle natively has NULLS First/NULLS Last)

please indicate dbms vendor and version (if this comment is relevant).
Avatar of Fordraiders

ASKER

Thanks
Avatar of [ fanpages ]
[ fanpages ]

You're welcome :)