I'm trying to run a query that returns two sets of results from the same table.
Basically, I have a table like this..
id | surveyid | questiontext
1 | 1 | whats my name?
2 | 1 | whats my dob?
3 | 1 | whos your daddy?
And in the same query, I want to return a count of the number of rows with the surveyid of '1', and in the SAME query I want to return all the rows where the questions match what I'm sending in the query.
For example...
SELECT COUNT(id) FROM mytable WHERE surveyid = 1;
SELECT COUNT(id) FROM mytable WHERE surveyid = 1 AND questiontext IN ('whats my name?', 'whats my dob?', 'whos your daddy?');
I can do it in two queries in MySQL. Would anyone mind helping me turning it into one
SQL query?
chears