Thursday, 15 September 2011

mysql - SQL - Get list of messages as well as a count value -



mysql - SQL - Get list of messages as well as a count value -

i have page lists messages using sql follows:

select * comments $qwhere order comment_date desc limit $qstart,$qlimit

how can retrieve number of messages share same comment_number (this not primary key of table, number type column) on row row basis i.e.

select count(something), * ... comments

it this: (edit: added variables)

select count(comment_number), comments comments $qwhere grouping comment_number order comment_date desc limit $qstart,$qlimit

count , group by beingness items work.

you might find this tutorial helpful well.

mysql sql

No comments:

Post a Comment