Thanks a lot for your help everyone!!! It worked!! Woohoo!! Not only
that, I learned about joins! :)
/sunny
--- Steve Werby <[EMAIL PROTECTED]> wrote: > "Sandeep Hundal"
<[EMAIL PROTECTED]> wrote:
> > thanks for the tip steve. i read up on left joins, and got this:
> > SELECT diary.id, diary.the
rica - Q Data Consulting
www.pqafrica.co.za
Tel No : +27 +43 +722
Cell No: 082 870 3205
- Original Message -
From: Sandeep Hundal <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 08, 2001 6:11 AM
Subject: [PHP] Super SQL problem! Please advise!
"Sandeep Hundal" <[EMAIL PROTECTED]> wrote:
> thanks for the tip steve. i read up on left joins, and got this:
> SELECT diary.id, diary.thedate, diary.topic, diary.entry
> FROM diary
> LEFT JOIN comments
> ON diary.id = comments.id;
>
> but it only joins the two tables.
Right. It took care of yo
thanks for the tip steve. i read up on left joins, and got this:
SELECT diary.id, diary.thedate, diary.topic, diary.entry
FROM diary
LEFT JOIN comments
ON diary.id = comments.id;
but it only joins the two tables. What I need is only 1 column from
the second table, counted. Something like this,
"Sandeep Hundal" <[EMAIL PROTECTED]> wrote:
> SELECT diary.id, diary.thedate, diary.topic, diary.entry,
> count(comments.id) AS comments FROM diary, comments WHERE
> diary.month='$month' AND diary.id = comments.id GROUP BY comments.id
> ORDER BY diary.id DESC "
>
> Basically what I've done is made
Hey all,
I got this massive query, which I hope you'll be able to understand:
SELECT diary.id, diary.thedate, diary.topic, diary.entry,
count(comments.id) AS comments FROM diary, comments WHERE
diary.month='$month' AND diary.id = comments.id GROUP BY comments.id
ORDER BY diary.id DESC "
Basical
6 matches
Mail list logo