Link to home
Start Free TrialLog in
Avatar of SurfingHamster
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?MRID={' + CAST(ProductUID AS varchar(80)) + '}',
      FROM tProduct
GO
ASKER CERTIFIED SOLUTION
Avatar of BillAn1
BillAn1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial