SurfingHamster
asked on
Returning extra value with SQL SELECT
I want to return an extra column with an SQL Statement called "Live" which is dependent on if ALL the following are true:
- I want to return "Live" as 1 IF column ExpiryDate > Today's date
- I want to return "Live" as 1 IF column CommenceByDate >= Today's date
- I want to return "Live" as 1 IF column AvailableOnWeb = 1
Here's the SPROC as it stands (many rows will be returned):
CREATE PROCEDURE dbo.pGetMortgageProducts
...
SELECT
ProductUID As [Product Identifier],
[Name] As [Product Name],
ExpiryDate As [Expiry Date],
LinkURL = '../ProductDetails.aspx?MR ID={' + CAST(ProductUID AS varchar(80)) + '}',
FROM tProduct
GO
- I want to return "Live" as 1 IF column ExpiryDate > Today's date
- I want to return "Live" as 1 IF column CommenceByDate >= Today's date
- I want to return "Live" as 1 IF column AvailableOnWeb = 1
Here's the SPROC as it stands (many rows will be returned):
CREATE PROCEDURE dbo.pGetMortgageProducts
...
SELECT
ProductUID As [Product Identifier],
[Name] As [Product Name],
ExpiryDate As [Expiry Date],
LinkURL = '../ProductDetails.aspx?MR
FROM tProduct
GO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.