Name | Status | value -----+-------------+------- wec1 | rotortemp | Null wec1 | baldetemp | Null wec1 | Cabinettemp | 1 wec2 | rotortemp | Null wec2 | baldetemp | Null wec2 | Cabinettemp | Null
如何选择所有wec1,因为wec1的一行值= 1
答案 0 :(得分:0)
试试这个:
SELECT *
FROM TableName
WHERE Name IN (SELECT Name
FROM TableName
WHERE value=1)
答案 1 :(得分:0)
不确定你的意思,但也许是这样的:
SELECT Name,
Status,
value
FROM yourtable
WHERE Name IN (
SELECT Name
FROM yourtable
WHERE value = 1
)