Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 15th, 2005, 12:54 PM
Authorized User
 
Join Date: Jun 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL count query not giving correct results

Hi,

I have 2 tables 'ecastdata' and 'ecastops'. I am running a COUNT on the number of records from the 'ecastdata' table with a specific ID from both tables.

I am excluding certain email addresses from both tables. The email addresses in the 'ecastdata' table are in one column: |Email|.
The 'ecastops' table has the email addresses in seperate columns, for example: |EcastOpSeed1|EcastOpSeed2|EcastOpSeed3|

The problem is the query does not seem to get a value from the column: |EcastOpSeed3|
When I run the query the total count result is 7734 and should be 7733 records.

Plese Help!!!

Here is the query I'm using:

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

 
Old March 15th, 2005, 01:15 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cross Post:


http://p2p.wrox.com/topic.asp?TOPIC_ID=27966






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL query on Access db giving error DesignsOnline.co.uk Access 2 November 17th, 2006 05:06 PM
SQL count query not giving correct results hman SQL Language 2 March 16th, 2005 07:06 AM
SQL query for count programmer_kay ADO.NET 1 April 18th, 2004 02:48 AM
SQL query for count programmer_kay SQL Language 1 April 17th, 2004 07:30 PM
Query not returning correct results from database Jams30 PHP Databases 5 November 7th, 2003 08:55 AM





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