Re: Grab data WHERE table.ID NOT LIKE otherTable.ID

Поиск
Список
Период
Сортировка
От Nils Zonneveld
Тема Re: Grab data WHERE table.ID NOT LIKE otherTable.ID
Дата
Msg-id 3B46EBD8.AB262046@mbit.nl
обсуждение исходный текст
Ответ на Grab data WHERE table.ID NOT LIKE otherTable.ID  ("Mark G. Franz" <mgfranz@pe.net>)
Список pgsql-general

"Mark G. Franz" wrote:
>
> Here is my SQL;
>
> "SELECT Registration.CustomerID, Customer.CustomerID AS CustID, Firstname,
> Lastname, Username, Password, Question, Answer, Email, Age, Gender, Address,
> City, State, Zip FROM Customer, Registration WHERE Customer.CustomerID NOT
> LIKE Registration.CustomerID"
>
> I'm trying to return all the records from Customer that have not registered
> in Registration, so the psuedo sql would read;
>
> Return everything from all fields in Customer where the ID is NOT in the
> Registration table.  Any ideas?
>
> Thanks,
>
> Mark

Try the NOT EXISTS operator:

SELECT Customer.CustomerID AS CustID, Firstname, Lastname, Username,
Password, Question, Answer, Email, Age, Gender, Address, City, State,
Zip
FROM   Customer
WHERE  Customer.CustomerID
       NOT EXISTS (SELECT *
                   FROM   Registration
                   WHERE  Registration.CustomerID = Customer.CustomerID);



Hope this helps,

Nils Zonneveld
--
Alles van waarde is weerloos
Lucebert

В списке pgsql-general по дате отправления:

Предыдущее
От: "guard"
Дата:
Сообщение: pltcl.dll
Следующее
От: "Dr. Evil"
Дата:
Сообщение: Re: Stored Procedure Newbie