If you are using a version of MySQL that supports subqueries, you can do
something like this:

select * from unprocessed_url_table
where url not in (select url from processed_url_table)

In other words, the inner query (the part in brackets) is returning a list
of all the URLs that have been processed, according to the table which lists
the processed URLs; the rest of the query is getting rows of tables whose
URLs have *not* been processed.

I *think* MySQL V4.1.x supports subqueries but I might be wrong; perhaps
only V5.x supports it. I'm afraid I haven't been doing much with MySQL
lately and forget exactly when each feature was made available.

If you don't have a version that supports subqueries, it should be possible
to do what you want a different way, probably with temporary tables. Ask
again in you need to know how to do it that way. I think I've got an example
lying around of how to do it with temporary tables.

Rhino

----- Original Message ----- 
From: "Nurullah Akkaya" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Saturday, October 08, 2005 8:43 PM
Subject: selecting from 2 tables


> i have two tables one of them is a que of urls and the other is list
> of urls that have been processed
> now i want to select a url from Que that is not in the processed urls
> table how can i do this in one select i do not want my application to
> do two seperate select statements?
>
> thx..
>
>
>
> Nurullah Akkaya                                 What lies behind us
> and what
> [EMAIL PROTECTED]         lies before us are tiny matters
> Registered Linux User #301438     compared to what lies within us.
>
> WARNING all messages          "If at first an idea is not
> containing attachments             absurd, there is no hope for it"
> or html will be silently               Albert Einstein
> deleted. Send only
> plain text.
>
> Because the people who are crazy enough to think
> they can change the world, are the ones who do.....
>
>


----------------------------------------------------------------------------
----


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 07/10/2005



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 07/10/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to