i have 'topic' and 'comment' fields in table of database ,when some one give comment on topic no 1 ,it save in dabase with topic number and comment,
i want show topic number with higest comment.
tell me sql query to show result

Recommended Answers

All 3 Replies

SELECT count(*) AS count, topic 
FROM comments 
GROUP BY topic
ORDER BY count DESC LIMIT 1

nt show topic number with higest comment.
tell me sql query to show result

tell me same query if my table name is 'orange'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.