Jump to content

SQL Group BY error


houssam_ballout

Recommended Posts

you may want to review: http://dev.mysql.com/doc/refman/5.0/en/counting-rows.html

 

 

im not sure what exact reslults your trying to get and what your table structure is but you could try this:

 

select count(OptionNb),comments from tblanswer where idQuestion = $idQuestion And OptionNb = 'option$i'  GROUP BY `comments`

Link to comment
Share on other sites

I'm curious to know what information you're trying to get out of this.

On 1st inspection I thought you were after the number of comments for a particular question, however I then realised you appear to be after something related to OptionNB. What is OptionNB?

 

The query that uniflare has given you will count the number of options based on comment, where the question id is set and the OptionNB is set.

 

Clarify what you're expecting from this query and i'm sure we can guide you in the right direction.

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.