Select statement
anonymous_at_discussions.microsoft.com
Date: 05/11/04
- Next message: Steve Kass: "Re: Third largest salary"
- Previous message: KK: "Select statement"
- In reply to: KK: "Select statement"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 May 2004 12:36:40 -0700
Lookup up COALESCE in BOL.
For Example:
SELECT ( COALESCE( CompanyName, [Last Name] + [First
Name] ) ) AS MyColumn
FROM MyTable
>-----Original Message-----
>This is regarding a SQL Select statement
>I have a table with 3 columns First Name, Last Name ,
>CompanyName
>I want a result of companyName, using a select statement
>with the condition that
>if CompanyName is Null then result should have LastName +
>FirstName
>
>something like
>if CompanyName is null Then
>Select LastName + FirstName from Table
>else
>Select CompanyName from Table
>
>Can this if..else be used in a single Select statement?
>.
>
- Next message: Steve Kass: "Re: Third largest salary"
- Previous message: KK: "Select statement"
- In reply to: KK: "Select statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|