Simple SQL Query??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi. I'm having some issues with a query that I require. In my mind it should
be simple but for the life of me I can not figure out how to go about doing
it. The below query, queries a MSSQL database and returns what security
group a web account user is in. 

Now I need another query that will return the opposite of this. Web Accounts
that are not in a security group
(tblWebAccountGroup.Web_Account_Group_Name_ID != var). Sounds simple to me
and possible using an SQL query. At present I've done such queries in PHP by
writing two queries and doing a data comparison and return what is different
between the two queries. As I'm sure you realize this is a major amount of
coding to do this manually. How can I do this using SQL? Any help would be
greatly appreciated.

BTW, I'm using IIS v5.0.2195.3649 with PHP v4.2.3 and MSSQL Server 2000
(v8.00.760 Intel X86). If you need any table schemas or other information
please let me know.

$szQry = "SELECT tblWebAccounts.People_ID, viewPeople.First_Name,
viewPeople.Last_Name
FROM tblWebAccounts, viewPeople, tblWebAccountGroup
WHERE tblWebAccountGroup.Web_Account_Group_Name_ID=$_POST[nSecurityGroup]
AND tblWebAccounts.People_ID=viewPeople.People_ID
AND tblWebAccounts.Web_Account_ID=tblWebAccountGroup.Web_Account_ID
ORDER BY viewPeople.First_Name, viewPeople.Last_Name";

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux