there exist two different 'select' in your query string. divide them into two different SqlCommand (at least, different times with a single SqlCommand) like:
using(cmd = new SqlCommand("query1")) {
SqlDataReader reader = cmd.ExecuteReader();
cmd.CommandText = "query2";
reader = cmd.ExecuteReader();
}
see here:
SqlCommand[
^]
and here:
SqlDataReader[
^]