Sunday, 15 June 2014

mysql combine multiple select statement results -


I have two statements for two people to draw data from 2 tablets. I know they have one way to join , But I can not get the syntax to work for me

Query 1:

  select SUBSTRING_INDEX (user name, '@ ', 1) Username, COUNT (user name) as count, ROUND (sum (CONVERT (SUBSTRING (contribution_score, -2), unsigned integer) + CONVERT (SU) BCC (Integrated integer) + CONVERT (SUBSTRING (prepared_score, -2), unsigned integer) + CONVERT (SUBSTRING (work_score, -2), unsigned integer)) / COUNT (username) / 76 * 100 ) Avg. From the project_rubrics group, type the username, range 0, 90   

query2:

  select username, COUNT (username) ) Username   

is the common link user name field by logon group as the day.
I want to set a result, which gives usernames, days and averages for each student, but I can not get involved in joining or joining

Any help appreciated She goes.

You can do a subquery

  select SUBSTRING_INDEX ( Username, '@', 1) Username, COUNT (user name) as count, ROUND (sum (CONVERT (SUBSTRING (contribution_score, -2), unsigned integer) + CONVERT (SUBSTRING (focused_score, - 2), unsigned integer) + CONVERT (SUBSTRING (prepared_score, -2), unsigned integer) + CONVERT (SUBSTRING (work_score, -2), unsigned integer)) / COUNT (user name) / 76 * 100) in the form of average , (COUNT (Username) Select the logon.username = project_rubrics.username group by the user name as the day from the logon) as username_count from the user name range 0, 90    

No comments:

Post a Comment