sql - Get reply numbers in mysql -


I am working on a product review page where it has been submitted for many submissions Will display the number of comments.

I thought

  as the title of review_title, COUNT (id_group) Approved_reply_number where approved and I can use as lt; & Gt; '0' Group by ID_ Group '  

But read it that it is not possible to copy the ID values ​​to the second line in the process of inserting any review, if presented id_group field to be left blank for review

here:.

  CREATE TABLE product_review (`id`int,` title 'varchar (21), `id_group` int,` valid` int); The value (1, 'AAA', Null, 1), (2, 'BBB', 1,1), (3, 'CCC') in the product_review (`id`,` title`, `id_group`,` approved`) ', Tap, 1), (4,' DDD ', 3,0), (5,' EE ', 1,1), (6,' FFF ', null, 1), (7,' ggji '6 , 1), (8, 'HHH', 1,1), (9, 'III', 6, 1);   

Those who have tap into id_group are the submitted reviews, the rest are answers and their respective reviews have an ID. I was wondering how can I get an output like this:

  review_title approved_reply_number AAA3CCC0FFF2    

< Div class = "post text" itemprop = "text">

You can join a self and use the counting query with the group> select and also to filter out an outside review where the segment only

  Haha Given  



Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -