mysql - inner join with COUNT() and GROUP BY -


i using phpmyadmin test query keep getting syntax error. i've tried looking in mysql manual , trying other syntactical possibilities i've gotten older in process. help

select image_title, image_id, count(other_sales.*) art inner join other_sales on (art.image_id=other_sales.image_id) group (other_sales.image_id);

mysql said: documentation

documentation

1052 - column 'image_id' in field list ambiguous

ultimately, want count number of times specific number (image_id) occurs in 'other_sales' table

to troubleshoot these 1064 errors:

the error message gives snippet of query. first character of snippet first character mysql interpreter not understand.

so in case of query, it's

select image_title, image_id, count(other_sales.*) art inner join ... ggggggggggggggggggggggggggggggggggggggggggggggggbbbbbbbbbbbbbbbbbbbbbbbbbbb 

where g means , b means bad.

your actual problem: can't put more 1 value in count() function. tried put count(something.*) makes no sense count.

notice count(*) special case meaning count rows.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -