Link to home
Create AccountLog in
Avatar of MBoy
MBoy

asked on

SQL - Conditional return of data

I'd like to remove any value from Data1 that is less than < 99

CREATE PROCEDURE [dbo].[KeyReportsAllEventsByOperator]
(
            @Operator As varchar(200)
)
AS
BEGIN
     SELECT
         [EventDateTime] As Date,
             [Vehicle],
             [Operator],
         [EventType] As Event,            
         [Data1],
         [Data2]
     FROM
         [RemoteData]
      WHERE @Operator = [Operator]
       ORDER BY [EventDateTime] DESC
END
GO
Avatar of rocky_lotus_newbie
rocky_lotus_newbie
Flag of India image

If you want to exclude the recrods which have Data 1 less than 99 use below:

CREATE PROCEDURE [dbo].[KeyReportsAllEventsByOperator]
(
            @Operator As varchar(200)
)
AS
BEGIN
     SELECT
         [EventDateTime] As Date,
             [Vehicle],
             [Operator],
         [EventType] As Event,            
         [Data1],
         [Data2]
     FROM
         [RemoteData]
      WHERE @Operator = [Operator] AND [DATA 1]<99
       ORDER BY [EventDateTime] DESC
END
GO

Do you want to update the records where Data 1<99?

Thanks,
Avatar of MBoy
MBoy

ASKER

I don't want lose the record row.  I want to change [Data1] = 1 to [Data1] = ""
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer