Solved

SQL 2008 SELECT

Posted on 2013-06-05
3
364 Views
Last Modified: 2013-06-05
Hello,
Can you please help,
I'm trying to do a simple select.

SELECT * FROM ScanItem where scanin is Null   (I get proper results - all data )
SELECT * FROM ScanItem where scanin is Null  and CCDriverNumber is NULL (I get proper results)

When I add another AND, I get no results. (i SHOULD GET FEW HUNDERED)
SELECT * FROM ScanItem where scanin is Null  and CCDriverNumber is NULL AND CCDriverNumber <> 2529

What am I missing?

thanks
0
Comment
Question by:W.E.B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
santoshmotwani earned 250 total points
ID: 39224376
SELECT * FROM ScanItem where scanin is Null  and CCDriverNumber is NULL
union all
SELECT * FROM ScanItem  where ccdriverNumber <> 2529

or

SELECT * FROM ScanItem where scanin is Null
and
((ccdriverNumber <> 2529) or (ccdriverNumber is null))
0
 

Author Comment

by:W.E.B
ID: 39224383
This did it, thanks
0
 

Author Closing Comment

by:W.E.B
ID: 39224385
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add a step to a system backup job 6 55
Checking for column changes SQL 2014 4 42
T-SQL: I need to add an index on a field 5 50
Need to replicate a Log table 4 41
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question