i want to show the favorite news base on calculation coment in comment table..
so ? what should i do?
Linddha 0 Light Poster
Recommended Answers
Jump to PostTry:
SELECT A.Id, A.Title, COUNT(*) AS CommentCount FROM Article A, Comment C WHERE C.Id_News = A.Id GROUP BY A.Id ORDER BY CommentCount DESC
Jump to PostCan you give an example of the output you want? Am not sure I understand what you want.
Jump to PostSimilar to the previous one:
SELECT C.Id, C.Name, COUNT(*) AS CommentCount FROM Group G, Article A, Comment C WHERE A.Id_Group = G.Id_Group AND C.Id_News = A.Id GROUP BY C.Id ORDER BY CommentCount DESC
All 11 Replies

diafol
Linddha 0 Light Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Linddha 0 Light Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Linddha 0 Light Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Linddha commented: great ! it works ! +0
Linddha 0 Light Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Linddha 0 Light Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
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.