Hi.
On Tue, Nov 20, 2001 at 11:38:01AM +0530, [EMAIL PROTECTED] wrote:
> Hello,
>
> I have a problem related SQL Query
>
> SELECT a.cAction_Name,a.nAction_ID FROM tbl_actionmaster a LEFT JOIN
> tbl_roleactionrelation b ON a.nAction_ID != b.nAction_ID
> WHERE b.nRole_ID = 3
> group by a.cAction_Name
>
> In this query i wants to find Action name and Action Id from the Action
> Master table.
> As comparing with RoleActionReation table (field -> nAction_ID , nRole_ID )
>
> I need those Action Name which are not mapped with the Role Name .
[...]
To which part in the above query refers "role name" to?
Note that "a != b" will match _every_ row, where "a != b", i.e. if you
have ids ranging from 1 to 3, you will get (1,2), (1,3), (2,1), (2,3),
(3,1), (3,2). This is the inverse set to "a = b", which is (1,1),
(2,2), (3,3).
If I understand you correctly, you want something like
SELECT a.cAction_Name, a.nAction_ID
FROM tbl_actionmaster a
LEFT JOIN tbl_roleactionrelation b
ON a.nAction_ID = b.nAction_ID AND b.nRole_ID = 3
WHERE b.nAction_ID IS NULL
GROUP BY a.cAction_Name
Bye,
Benjamin.
--
[EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php