Question

Name | Status      | value
-----+-------------+-------
wec1 | rotortemp   | Null
wec1 | baldetemp   | Null
wec1 | Cabinettemp | 1
wec2 | rotortemp   | Null
wec2 | baldetemp   | Null
wec2 | Cabinettemp | Null

How can I select all the wec1 because the value of one row of wec1 is = 1

Was it helpful?

Solution

Try this:

SELECT *
FROM TableName
WHERE Name IN (SELECT Name
               FROM TableName
               WHERE value=1)

OTHER TIPS

Not sure exactly what you mean, but maybe something like:

SELECT      Name,
            Status,
            value

FROM        yourtable

WHERE       Name IN (
    SELECT      Name
    FROM        yourtable
    WHERE       value = 1
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top