I basically have 3 queries that I need to run to provide specific answers to my users. Whether the machine is Running(Deployed), Not Running(Available) or "In Maintenance"(Unavailable). The first and third queries run fine. However the
second one (in Bold)is where I'm having additional trouble, it needs to check to see if the Machine is "In Mainenance" or not. If it is not in mainenance then it should get its value from the Designated amounts Table, Else it should give the value of
"Not Running" but able to if needed.
Needs to check to determine if it is Available(i.e. Not Running) ("SELECT TOP (1) CASE WHEN V300938F <= '.1'") it then needs to check to see if it matches this Criteria "WHERE (dbo.Designated_Amount.Unit_Code = '114') AND SIMS.Event_Type
in ('IR','ME','MO','PE','PO','RU','SF','U1','U2','U3') AND (dbo.SIMS.EventEndTS IS NULL) AND (dbo.SIMS.Avail_Cap = 0)" then it should return a '0', if it doesn't match the Where clause it should return the value from the Designated_Amounts table.
declare @Amount float
select top 1 @Amount = CAST(dbo.Designated_Amount.Amount AS Float)
View Complete Post