SELECT
DT, FlowParam, Abs_P, T, Volume, Energy, FlowTime_T,
(SELECT ' > 1 ' AS Expr1 WHERE (
(SELECT COUNT(*) AS Expr2
FROM dbo.BACS_Alarm_1
WHERE
(DT_T >= dbo.BACS_HourFlow_1.DT_T) AND
(DT_T <= dbo.BACS_HourFlow_1.DT_T + dbo.BACS_HourFlow_1.FlowTime_T)
) > 1
)) AS Something
FROM dbo.BACS_HourFlow_1
I need output field AS Something
from BACS_Alarm_1
table if WHERE... = 1
and output Null
if = 0
...and output my message if > 1 (that's already made)
How can I realize this case ?
So if
(SELECT COUNT(*) AS Expr2
FROM dbo.BACS_Alarm_1
WHERE
(DT_T >= dbo.BACS_HourFlow_1.DT_T) AND
(DT_T <= dbo.BACS_HourFlow_1.DT_T + dbo.BACS_HourFlow_1.FlowTime_T)
) > 1
I output ' > 1 ' as something
if = 1 I output a field from dbo.BACS_Alarm_1 if = 0 I output 0 or null