Re: Help with a query please
shaun thornburgh schrieb: > Thanks for your reply, I would like the query to retun one > instance of user 101 rather than 15! SELECT DISTINCT ... Regards, A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Help with a query please
what about your query returning all the users UNION your query returning user 101? SELECT U.User_ID, U.User_Firstname, U.User_Lastname FROM Users U, Allocations A WHERE (U.User_ID = A.User_ID) AND A.Project_ID = '12' AND ( U.User_Type = 'Staff' OR U.User_Type = 'Manager' OR U.User_Type = 'Administrator' ) ORDER BY User_Firstname UNION SELECT U.User_ID, U.User_Firstname, U.User_Lastname FROM Users U WHERE (U.User_ID = 101) not sure to understand what you want to do with the join if you anyway want to retrieve user 101 and select only the parameters from the first table From: "shaun thornburgh" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], mysql@lists.mysql.com Subject: Re: Help with a query please Date: Mon, 21 Feb 2005 13:24:55 + From: "Rhino" <[EMAIL PROTECTED]> To: "shaun thornburgh" <[EMAIL PROTECTED]>, Subject: Re: Help with a query please Date: Mon, 21 Feb 2005 08:22:29 -0500 - Original Message - From: "shaun thornburgh" <[EMAIL PROTECTED]> To: Sent: Monday, February 21, 2005 7:28 AM Subject: Help with a query please > Hi, > > I am having trouble with the following query: > > SELECT U.User_ID, > U.User_Firstname, > U.User_Lastname > FROM Users U, Allocations A > WHERE (U.User_ID = A.User_ID OR U.User_ID = 101) > AND A.Project_ID = '12' > AND ( U.User_Type = 'Staff' > OR U.User_Type = 'Manager' > OR U.User_Type = 'Administrator' ) > ORDER BY User_Firstname; > > The query is meant to return all the users in the allocations table plus > user 101, however the query returns 15 instances of the 101 user along with > all the users in the allocations table... > What's the problem then? It seems to be doing exactly what you want to do. Can you clarify how the actual result differs from the expected result? So far, they sound the same Rhino -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 18/02/2005 Hi Rhino, Thanks for your reply, I would like the query to retun one instance of user 101 rather than 15! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] _ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Help with a query please
From: "Rhino" <[EMAIL PROTECTED]> To: "shaun thornburgh" <[EMAIL PROTECTED]>, Subject: Re: Help with a query please Date: Mon, 21 Feb 2005 08:22:29 -0500 - Original Message - From: "shaun thornburgh" <[EMAIL PROTECTED]> To: Sent: Monday, February 21, 2005 7:28 AM Subject: Help with a query please > Hi, > > I am having trouble with the following query: > > SELECT U.User_ID, > U.User_Firstname, > U.User_Lastname > FROM Users U, Allocations A > WHERE (U.User_ID = A.User_ID OR U.User_ID = 101) > AND A.Project_ID = '12' > AND ( U.User_Type = 'Staff' > OR U.User_Type = 'Manager' > OR U.User_Type = 'Administrator' ) > ORDER BY User_Firstname; > > The query is meant to return all the users in the allocations table plus > user 101, however the query returns 15 instances of the 101 user along with > all the users in the allocations table... > What's the problem then? It seems to be doing exactly what you want to do. Can you clarify how the actual result differs from the expected result? So far, they sound the same Rhino -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 18/02/2005 Hi Rhino, Thanks for your reply, I would like the query to retun one instance of user 101 rather than 15! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Help with a query please
- Original Message - From: "shaun thornburgh" <[EMAIL PROTECTED]> To: Sent: Monday, February 21, 2005 7:28 AM Subject: Help with a query please > Hi, > > I am having trouble with the following query: > > SELECT U.User_ID, > U.User_Firstname, > U.User_Lastname > FROM Users U, Allocations A > WHERE (U.User_ID = A.User_ID OR U.User_ID = 101) > AND A.Project_ID = '12' > AND ( U.User_Type = 'Staff' > OR U.User_Type = 'Manager' > OR U.User_Type = 'Administrator' ) > ORDER BY User_Firstname; > > The query is meant to return all the users in the allocations table plus > user 101, however the query returns 15 instances of the 101 user along with > all the users in the allocations table... > What's the problem then? It seems to be doing exactly what you want to do. Can you clarify how the actual result differs from the expected result? So far, they sound the same Rhino -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 18/02/2005 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Help with a query please
Hi, I am having trouble with the following query: SELECT U.User_ID, U.User_Firstname, U.User_Lastname FROM Users U, Allocations A WHERE (U.User_ID = A.User_ID OR U.User_ID = 101) AND A.Project_ID = '12' AND ( U.User_Type = 'Staff' OR U.User_Type = 'Manager' OR U.User_Type = 'Administrator' ) ORDER BY User_Firstname; The query is meant to return all the users in the allocations table plus user 101, however the query returns 15 instances of the 101 user along with all the users in the allocations table... Any help here would be greatly appreciated. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]