Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2005, 01:14 PM
Authorized User
 
Join Date: Jun 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using wildcards in subquery

Hi,

I am wanting to exlude the coulmn |EcastOpSeed1| in my "subquery" using a wildcard.I am extracting results from 2 tables 'ecastdata' and 'ecastops'.

The coulmn |EcastOpSeed1| in 'ecastops' table contains domain-names that I want to exclude from the overall selection.

How do I implement the % wildcard in the sub SELECT query

Something like??:
(
 SELECT %ecastops.EcastOpSeed1 FROM ecastops WHERE
 ecastops.EcastOpID = 46 AND ecastops.EcastOpSeed1 IS NOT NULL
)

Please help!

Here is my full query:


SELECT COUNT(*) AS intTotal
FROM ecastdata
WHERE ecastdata.EcastID = 46
AND ecastdata.Email NOT LIKE '%hotmail.com.com'
AND ecastdata.Email NOT LIKE '%yahoo.com'
AND ecastdata.Email NOT IN
(
 SELECT ecastops.EcastOpSeed1 FROM ecastops WHERE
 ecastops.EcastOpID = 46 AND ecastops.EcastOpSeed1 IS NOT NULL
)

 
Old April 6th, 2005, 03:35 AM
Authorized User
 
Join Date: Feb 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try This....

SELECT COUNT(*) AS intTotal
FROM ecastdata
WHERE ecastdata.EcastID = 46
AND ecastdata.Email NOT LIKE '%hotmail.com.com'
AND ecastdata.Email NOT LIKE '%yahoo.com'
AND NOT EXISTS(
 SELECT * FROM ecastops WHERE
 ecastops.EcastOpID = 46 AND ecastops.EcastOpSeed1 IS NOT NULL
 AND ecastdata.Email like '%'+ecastops.EcastOpSeed1
)

Cheers,
Pooja Falor
 
Old April 11th, 2005, 06:18 AM
Authorized User
 
Join Date: Jun 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Pooja, that worked nicely :)


Quote:
quote:Originally posted by poojafalor
 Try This....

SELECT COUNT(*) AS intTotal
FROM ecastdata
WHERE ecastdata.EcastID = 46
AND ecastdata.Email NOT LIKE '%hotmail.com.com'
AND ecastdata.Email NOT LIKE '%yahoo.com'
AND NOT EXISTS(
 SELECT * FROM ecastops WHERE
 ecastops.EcastOpID = 46 AND ecastops.EcastOpSeed1 IS NOT NULL
 AND ecastdata.Email like '%'+ecastops.EcastOpSeed1
)

Cheers,
Pooja Falor





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable the wildcards(% and _) kasipandian Oracle 1 February 4th, 2008 12:32 AM
ObjectDataSource and Wildcards pipelineconsulting ASP.NET 2.0 Professional 1 October 19th, 2006 09:08 PM
XSLT Wildcards? kwilliams XSLT 2 September 28th, 2005 10:54 AM
Datetime, wildcards etc SoC Classic ASP Basics 6 July 19th, 2005 08:53 PM
Help using wildcards in query hman SQL Language 2 April 6th, 2005 03:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.