On Fri, 17 Sep 2004 11:33:04 -0700 (PDT), David T. [EMAIL PROTECTED] wrote:
I am building a database with permissions for different modules. The
permissions table contains a separate row for each module/user combination,
You didn't say, but if you're using PHP you might find this of use:
- Original Message -
From: David T. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 17, 2004 2:33 PM
Subject: Problems with Left Join query
I am building a database with permissions for different modules. The
permissions table contains a separate row for each
First, you want to get an answer for every module, so you must use
modules LEFT JOIN permissions
to get a row for every module. You see? The table with missing rows (no
row for Bob/module3 in permissions) goes on the right.
When the table on the right does not have a matching row, the LEFT
Try
SELECT
pd.ANSWER_TEXT, pr.*, COUNT(*) as NUM
FROM
pollresponse left join polldata on pd.QUESTION_ID = pr.QUESTION_ID
WHERE
pd.VOTE_ID = pr.RESPONSE
GROUP BY pr.RESPONSE
Something like that will work better...probably you have to massage it a
little. Note that you were not getting