Get two row counts from the same table What I am trying to achieve is run both queries (below) at the same time. 
From one table rvsessions I need to get the count for the total amount of sessions(which is achieved by the number of times the rvsessions_user_id appears in the table) and the number of sessions correct (correct = 1 and incorrect = 0) 

&lt;?php
$query = "SELECT * , count(*) AS rvsession_user_id FROM rvsessions 
GROUP BY rvsession_user_id ORDER BY rvsession_user_id DESC";

$query = "SELECT * , count(*) AS rvsession_correct FROM rvsessions 
WHERE rvsession_correct = 1 GROUP BY rvsession_user_id";

$select_all_user_sessions = mysqli_query($connection,$query);
$total_user_session_count = mysqli_num_rows($select_all_user_sessions);

while($row = mysqli_fetch_assoc($select_all_user_sessions)) {

$rvsession_username  = $row['rvsession_username'];
$count_user_sessions = $row['rvsession_user_id'];
$count_sessions_correct = $row['rvsession_correct'];

echo "&lt;tr&gt;";
           echo "&lt;td&gt;$rvsession_username&lt;/td&gt;";
           echo "&lt;td&gt;$count_user_sessions&lt;/td&gt;";
           echo "&lt;td&gt;$count_sessions_correct&lt;/td&gt;";                             
echo "&lt;/tr&gt;";
                       }            
?&gt;


Each individual query runs fine and produces the correct results. 
When I run them together both counts are not producing the correct results. 
When I try to embed one query in the other as a nested sub-query, I get a syntax-error. I am at a loss... What would be the correct syntax for this?
SELECT *, 
       COUNT(*) AS rvsession_user_id,
       SUM(rvsession_correct=1) AS rvsession_correct
FROM rvsessions 
GROUP BY rvsession_user_id