If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Comparing filed in 2 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-28-04, 12:28
gbokas gbokas is offline
Registered User
 
Join Date: May 2004
Posts: 1
Comparing field in 2 tables

I am trying to compare a similar field in 2 tables to find where entry exists in tab1 but not in tab2. I am running the following sql to get this but can't find what I am doing wrong. Any help would be greatly appreciated.

when I run this:

select tab1.dets_t from tab1 where tab1.dets_t not in ( tab2.dets_t );

I get error:
217: Column (tab1) not found in any table in the query (or SLV is undefined).
Error in line 1
Near character position 56

TIA,
gbokas

Last edited by gbokas; 05-28-04 at 12:59.
Reply With Quote
  #2 (permalink)  
Old 05-28-04, 14:23
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
compare values in two tables

Hi gbokas,

You need to include a "select" on the second table

select column_value from first_table
where column_value not in
(select column_value
from second_table)

This should work, but if you have a problem try
selecting a UNIQUE value from second_table

good luck

mike
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On