1

should i be grouping here? i want to return all the rows relating to each relationship in the first where clause but i want the rows to be grouped by station (station_id)

whats the best way to do this?- i have tried this query below but it doesnt allow for return multiple rows in the where clause subquery

SELECT 
    posts.dated, user_data.user_id , user_data.delegate_no, user_data.first_name, user_data.surname, user_data.company_name, user_data.tel_no, user_data.email_addr, user_data.rfid_tag 
FROM 
    user_data, posts 
WHERE 
    posts.station_id = 
        ( SELECT station_id FROM upd8r_stations WHERE owner_id =  '12' ) 
    AND 
        user_data.user_id = posts.user_id 
ORDER BY posts.dated DESC;

1 Answer 1

4

Use IN?

WHERE 
    posts.station_id IN 
        ( SELECT station_id FROM upd8r_stations WHERE owner_id =  '12' ) 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.