473,419 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Need to find rows in one table which does NOT match data in 2nd table

I have two tables, storage1 and storage2. These tables are setup differently however, storage1.custbox contains data that may match one, two or three columns from storage2, which are storage2.custboxnbr, storage2.boxnbr, storage2.reference1(if there's a match, it would just be one row). I'm trying to find the rows in storage2 where the data in storage2.custboxnbr, storage2.boxnbr, storage2.reference1 have no match to storage1.custbox. There are also some rows where these fields are empty, but I don't want these empties returned in the select.
Mar 2 '10 #1
2 1921
ck9663
2,878 Expert 2GB
try if this will work..

Expand|Select|Wrap|Line Numbers
  1.  
  2. select * 
  3. from storage2 s2
  4. where not exists (select 1 from storage1 s1 where s1.custbox not in (storage2.custboxnbr, storage2.boxnbr, storage2.reference1)
  5.  
  6.  
Happy Coding!!!

~~ CK
Mar 2 '10 #2
The query runs, but finds zero records... It should find about 7,000 rows. Thanks anyway.
Mar 3 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sebastian | last post by:
The following query needs about 2 minutes to complete (finding dupes) on a table of about 10000 addresses. Does anyone have an idea on how to speed this up ? Thanks in advance !!! Sebastian
16
by: Justin Hoffman | last post by:
This is a question concerning query optimisation. Sorry if it's a bit long, but thanks to anyone who has the patience to help - This is my first post here... If I have two tables:...
6
by: JJA | last post by:
I would like some advice on a data and query problem I face. I have a data table with a "raw key" value which is not guaranteed to be valid at its source. Normally, this value will be 9 numeric...
2
by: PaulNaude | last post by:
VB.NET 2003 I am battling with a specific procedure that does not allow me to update my data adapter due to an apparent syntax error. I created the data adapter usign the drag and drop method...
2
by: Dennis Gearon | last post by:
IPU, in place updates. -------------------------- 1/ Put a version numbers on each record represented by a byte/word sized number from a three version number list kept by the table header. This...
10
by: Mark | last post by:
I have a table about people containing 25 fields. The table contains the usual fields - first, last, address, city, state and zip. There is no primary key. These fields all have data with the...
8
by: Jack Addington | last post by:
I want to scroll through the alphabet in order to scroll some data to the closest name that starts with a letter. If the user hits the H button then it should scroll to the letter closest to H. ...
3
by: Solel Software | last post by:
Hello, I have a basic question. I have a DataTable of information without a database store (it's only in memory). I am looking to somehow query the DataTable to find out which row(s) satisfy...
3
by: Danielle | last post by:
Hello group- I am having a problem where joined tables are returning too many rows. Here is my scenario - I am trying to create a temporary table from parts of three tables - the important...
0
by: LanaR | last post by:
Hello, one sql statement is causing severe performance issue. The problem occurs only in UDB environment, the same statemnt on the mainframe is running fine. I have an explain output from the sql....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.