Jump to content

Table Structure Question


Padgoi

Recommended Posts

$q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where panels>=3  GROUP BY `sid` ORDER BY `avg` DESC LIMIT 0,5';

This line seems to be causing problems in one of my scripts in that it keeps referring me to this line and saying there is an invalid MYSQL result resource.  I'm fairly certain my table structure is off.  Can someone please tell me, based on this line, what fields I should have in my table and and what type they should be?  

 

I know the table name is groupcomic.  

Link to comment
Share on other sites

Yeah, it's actually 2 tables, groupcomic and yrat.  I ran the query directly in MYSQL and got this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `' at line 1

I assume it has something to do with the num_rat field but I honestly have no idea.  I had that field set up as INT (11).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.