troubleshooting Question

MYSQL IF() USAGE (AS COLUMN IF COLUMN IS NULL)

Avatar of Bob-Villa
Bob-Villa asked on
MySQL Server
1 Comment1 Solution815 ViewsLast Modified:
Need to know if this is possible and how to execute
[id|colA|colB]

colA and colB are similar datatypes (phone number for example)

want to

SELECT colA from TABLE where id>0 ORDER BY colA

but if colA data is NULL use colB and optionally have it sortable.
something like this may explain my thoughts better...
SELECT colA,colB AS colA if colA IS NULL from TABLE where id>0 ORDER BY colA




Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros