I am using Microsoft SQL Server 2000.
I am using JDBC in a java bean to connect to the database and I am using SQL to get data [SELECT] from a particular table.
With SQL I am trying to combine column A and column B into a single column, say column Z to sort [ORDER BY] by column Z.
The trick is that if column B is null or empty I want to display column A's data
otherwise, I want to display column B's data
Does any one know how to combine two columns into one using SQL?
This is the only thing that comes to mind
SELECT ColumnA AS ColumnZ
SELECT ColumnB AS ColumnZ
ORDER BY ColumnZ
Any hints, ideas, or suggestions are welcome!