I am trying to get a list of values from the same column in a table by running two queries.
This is what the table looks like:
******************************************
Key | Short_text | UID | Boolean_value
******************************************
Name | John | 23 | null
******************************************
Male | NULL | 23 | true
******************************************
Name | Ben | 45 | null
******************************************
Male | NULL | 45 | true
I am trying to get the SHORT_TEXT of the NAME rows if the Boolean values of the Male rows are true based on the UIDs
This is what I have so far (Which is throwing an error: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. )
SELECT SHORT_TEXT_VALUE
FROM Table
WHERE ((SELECT UID
FROM Table
WHERE KEY = 'NAME') =
(SELECT CUSTOMER_UID
FROM Table
WHERE KEY = 'Male'
AND BOOLEAN_VALUE = 1))
I am very new to sql so I am not sure what I should do to achieve what I would like.
Any help would greatly be appreciated.