Jean-Claude>I agree that LEFT JOIN is probably part of the solution. But the command you >suggest do not work, perhaps because several Chimeric_Cluster_IDs and >Unigene_ID are void or NULL. I want a list of AC from Chimeric_Cluster_IDs >that are not found in the gene_length table (Unigene_ID). It would perhaps be >necessary to extract each AC from Chimeric_Cluster_IDs and test each against >gene_length.Unigene_ID, but I really don't know how to do it.If there are rows with NULL keys in the gene_length table, and if you cannot fix that problem, you will need the NOT EXISTS(...) version of that query (examples at http://www.artfulsoftware.com/queries.php#29), something like ... SELECT ...
FROM 150genes AS g
WHERE NOT EXISTS(
SELECT chr_name
FROM gene_length AS l
WHERE g.Chimeric_Cluster_IDs LIKE CONCAT('%', l.Unigene_ID, '|%')
OR g.Chimeric_Cluster_IDs LIKE CONCAT('%', l.Unigene_ID, 'M%')
OR g.Chimeric_Cluster_IDs LIKE CONCAT('%', l.Unigene_ID)
)
ORDER BY ...
but be prepared for slowness. If your MySQL version is pre-4.1, or if
the subquery version is too slow, move the subquery to a separate
query, save it to a temp table (excluding the rows with NULLs), and
join 150genes to that.All this will perform much better if you can restructure the tables to permit equality comparisons rather than require LIKE comparisons, which are extremely slow. PB ----- Garaud Jean-Claude wrote: On Thursday 13 July 2006 14:19, Peter Brawley wrote:Jean-Claude |
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
