mysql question and a really bad joke
From: Alexander Ross (alexross_at_bleen.net)
Date: 03/21/04
- Next message: Pedro Graca: "Re: curly brackets necessary in php?"
- Previous message: Alexander Ross: "Re: simple mail form"
- Next in thread: torjon_at_NOSPAMnterport.net: "Re: mysql question and a really bad joke"
- Reply: torjon_at_NOSPAMnterport.net: "Re: mysql question and a really bad joke"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 21 Mar 2004 02:38:01 GMT
Lets say I have 2 tables, tbl_topics and tbl_lessons:
tbl_topics
topicID
INT
parentID
INT
Title
VARCHAR
tbl_lessons
lessonID
INT
topicID
INT (FK)
Other fields
I have a query that gives me all the topics who's parentID = $whatParentID
:
"SELECT topicID FROM tbl_topics WHERE parentTopicID=$whatTopicID"
Now I want to modify this query so I get a second column called count that
contains the number of times the returned topicID is found in tbl_lessons
even if that count is 0.
Example result:
topicID
Count
1000
2
1003
0
1021
4
In this example, topics 1000,1003,and 1021 all have a parentID of 1009 (or
whatever) and 1000 has 2 lessons, 1003 has 0, and 1021 has 4.
Anyone? Anyone? Bueller? Bueller?
BAD JOKE: (read this outloud)
Have you heard about circus sex? its in tents.
- Next message: Pedro Graca: "Re: curly brackets necessary in php?"
- Previous message: Alexander Ross: "Re: simple mail form"
- Next in thread: torjon_at_NOSPAMnterport.net: "Re: mysql question and a really bad joke"
- Reply: torjon_at_NOSPAMnterport.net: "Re: mysql question and a really bad joke"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|