Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help w/ a query 2

Status
Not open for further replies.

ryanrat

IS-IT--Management
Oct 30, 2001
30
US
Hello all,

I have a query that I have been using in Microsoft Access that doesn't work with mySQL. I was wondering if someone could help me convert this:

SELECT user.usrID, user.ctGiven, user.ctSurname,user.coName
FROM user
WHERE user.usrID NOT IN(
SELECT user.usrID
FROM user
INNER JOIN permissions on user.usrID = permissions.usrID
WHERE permissions.jobNumber = #attributes.jobNumber#)
AND user.permissions='user'
ORDER BY
user.ctSurname

into a mySQL compatible query.
 
Try something like this:
Code:
SELECT user.usrID,
       user.ctGiven,
       user.ctSurname,
       user.coName
FROM   user outher join permissions on (user.usrID = permissions.usrID and permissions.jobNumber = #attributes.jobNumber#)
WHERE  permissions.<<some column>> is null
AND    user.permissions='user'
ORDER BY user.ctSurname
 
Thanks for the reply.

I get the following error message (I assumed you meant &quot;outer join&quot; rather than &quot;outher join&quot;):

TCX][MyODBC]You have an error in your SQL syntax near 'outer join permissions on (user.usrID = permissions.usrID and permissions.jobNum' at line 5

Any suggestions?
 
I tried using this query:

SELECT user.usrID,
user.ctGiven,
user.ctSurname,
user.coName
FROM user left outer join permissions on (user.usrID = permissions.usrID and permissions.jobNumber = #attributes.jobNumber#)
WHERE permissions.usrID is null
AND user.permissions = 'user'
ORDER BY user.ctSurname

It appears to give the results I am seeking.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top