Domanda

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

È stato utile?

Soluzione

Try this:

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

Altri suggerimenti

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
)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top