Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
sql upit

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
vedran



Joined: 08 Sep 2003
Posts: 458

PostPosted: 26.02.2004 16:27    Post subject: sql upit Add user to your forum ignore list Reply with quote

Imam jedan problem u asp-u Smile

Imam dvije tablice u access bazi,tblNovosti,tblKomentari.
Te dvije tablice su povezane preko nekog id-a,znaci svaka novost ima vise komentara u tblKomentari.

I sad ja trebam sql upit da mi prikazuje Novosti(iz tblNovosti) tako da ih slaze(order by..) prema najvecem broju komentara.
Nadam se da je izvedivo tako nešto u jednom sql upitu.
Hvala

_________________
http://www.hocusvojweb.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
njava
mi3.crew


Joined: 25 Aug 2003
Posts: 624
Location: Zagreb

PostPosted: 26.02.2004 17:04    Post subject: Add user to your forum ignore list Reply with quote

nisam ziher da li ce ti raditi u accessu, ovo je mysql sintaksa. bitan ti je princip, konzultiraj access help ako sintaksa ne radi.

Code:
SELECT
    n.novost_id AS novost_id,
    n.naslov AS novost_naslov,
    COUNT(k.komentar_id) as broj_komentara
FROM
    tblNovosti as n LEFT JOIN
    tblKomentari as k ON (n.novost_id = k.novost_id)
WHERE
    k.novost_id IS NOT NULL
GROUP BY
    n.novost_id
ORDER BY
    broj_komentara DESC
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group