MySQL subquery required help -


I'm starting a mysql please help me

I have two table images and rates

I want to keep me at IgGID rate.

Image ID as PK in the image table.

The image rate table is foriegn key.

Rate table is sample data

  ImgID rating 1 5 1 7 1 8 2 8 3 2 4 3 1 4  
< P> image table sample data
  imgid comment rate 1 good 7 2 bad 8 3 ok 8 4 ok 8 5 bad 7  

excluded I EmigiId Average (rate from rate table compared to IGG ID)

For example

  Image if rate - --------- 1 6 2 8 3 2 4 3  

I need this output.

Thanks in advance

You do not need a subquery, is required.

  SELECT IMGID, Rate from ImageID by AVG Rate Rate  

If you have a rating or not, then you have all images Want to include:

  SELECT i.ImgID, Rate it from AVG (RRT) ImageTable on i.ImgID = r.ImgID Group i.ImgID  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -