Help wtih a query?
- From: skip@xxxxxxxxxxxxxxxxx (Skip Evans)
- Date: Tue, 30 Jan 2007 15:33:37 -0700
Hey all,
I have the following query:
$sql="SELECT count(*) AS count,votes.storyID,stories.title,stories.storyID as sID,stories.approved, stories.story,stories.userID, fname, lname
FROM `bsp_story_votes` as votes, bsp_story_stories AS stories, users AS usr
WHERE votes.storyID=stories.storyID AND stories.userID=usr.id AND stories.contestID=$contestID
GROUP BY votes.storyID
ORDER BY stories.approved,count DESC, sID ASC LIMIT $b_recno,$recs";
How would this need to be changed so that it would return rows for the members of the bsp_story_stories table that do not have records in the bsp_story_votes table?
Is that what the left/right joins do???
Thanks!
Skip
--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/
.
- Follow-Ups:
- Re: [PHP] Help wtih a query?
- From: Philip Thompson
- Re: [PHP] Help wtih a query?
- From: Brad Bonkoski
- Re: [PHP] Help wtih a query?
- From: Jon Anderson
- Re: [PHP] Help wtih a query?
- Prev by Date: RE: [PHP] Can't get PHP extension to Load
- Next by Date: Re: [PHP] Help wtih a query?
- Previous by thread: Re: [PHP] Select record by ID
- Next by thread: Re: [PHP] Help wtih a query?
- Index(es):