From: Philip Arnold
ISNull(ISNull(CompanyName, ttoOfficeName), 'n/a')
If CompanyName is null, then it will take ttoOfficeName
If both are null, then it will give n/a as the result for
the ORDER BY
Another possible solution:
Coalesce(CompanyName, ttoOfficeName, 'n/a')
It works from
You should be able to make one column out of the two
SELECT
CASE WHEN companyName is not null THEN companyName
ELSE WHEN ttoOfficeName is not null THEN ttoOfficeName
ELSE 'n/a' END as SiteName
FROM yourtable
ORDER BY SiteName
(Not sure if SQL server supports ordering yb aliases, but if not, it
From: Bryan F. Hogan
Anyone know of a way to somehow combine two columns into one
column in
the same query that I can order in MSSQL 2000?
What I have is a list of technologies that has an institution
column in
it's display. This column displays the companyName column if
it is not
Ok I'll try that. This option is a lot better than what I got working
below. I was going to combine those queries into a stored procedure and
call the procedure. ;-)
cfquery name=qry_selectIntoTemp datasource=#request.dsn#
SELECT *
INTO ##temp2
FROM tbl_contacts
/cfquery
cfquery
From: Deanna Schneider
(Not sure if SQL server supports ordering yb aliases, but if
not, it would probably support ordering by column number (in
this case 1).)
It doesn't, so you'd have to specify the same code in the ORDER BY
[Todays Threads]
[This Message]
[Subscription]
[Fast
Worked perfectly, thanks!
Philip Arnold wrote:
ISNull(ISNull(CompanyName, ttoOfficeName), 'n/a')
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
6 matches
Mail list logo