I need help with a Select Query

I need help with a Select Query

am 24.04.2005 00:12:37 von Wade

--------------030501060803090408030406
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

04232005 1707 GMT-6

I need to do something like this:
$sql = "SELECT * FROM application WHERE appid != rejected.appid ORDER
BY appid DESC";

I want to select all from application where the appid is not located in
the table rejected. Im having trouble getting this to work. Can somebody
help me here?

The rejected table has appid's that are rejected. If its in that list
then we dont want to call it.

Wade

--------------030501060803090408030406--

Re: I need help with a Select Query

am 24.04.2005 02:07:13 von Petr Vileta

One of the ways is

SELECT application.*,ISNULL(rejected.appid) AS ok FROM application
LEFT JOIN rejected ON(application.appid=rejected.appid)
HAVING ok ORDER BY application.appid DESC;

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)



----- Original Message -----
From: "Wade"
To:
Sent: Sunday, April 24, 2005 12:12 AM
Subject: I need help with a Select Query


> 04232005 1707 GMT-6
>
> I need to do something like this:
> $sql = "SELECT * FROM application WHERE appid != rejected.appid ORDER
> BY appid DESC";
>
> I want to select all from application where the appid is not located in
> the table rejected. Im having trouble getting this to work. Can somebody
> help me here?
>
> The rejected table has appid's that are rejected. If its in that list
> then we dont want to call it.
>
> Wade
>


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: I need help with a Select Query

am 26.04.2005 01:02:11 von jbonnett

You probably need something like this

SELECT application.*=20
FROM application LEFT JOIN rejected ON application.appid =3D
rejected.appid
WHERE rejected.appid IS NULL
ORDER BY appid DESC

The left join includes all rows from the application table and, where
there is no matching appid in the rejected table, it will be set to
null. Those are the ones you want.

John Bonnett

-----Original Message-----
From: Wade [mailto:wade@wadesmart.com]=20
Sent: Sunday, 24 April 2005 7:43 AM
To: win32@lists.mysql.com
Subject: I need help with a Select Query

04232005 1707 GMT-6

I need to do something like this:
$sql =3D "SELECT * FROM application WHERE appid !=3D rejected.appid =
ORDER=20
BY appid DESC";

I want to select all from application where the appid is not located in=20
the table rejected. Im having trouble getting this to work. Can somebody

help me here?

The rejected table has appid's that are rejected. If its in that list=20
then we dont want to call it.

Wade

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org