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 > Data Access, Manipulation & Batch Languages > ANSI SQL > Selecting from a particular table.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-04, 16:50
frankyvalley frankyvalley is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
Selecting from a particular table.

I have 2 Tables (TableA and TableB) and I want to pull the data from Table A if Table A's unique id is not in Table B and if it is then pull data from Table B.
Currently I have the following:

select prodid from tableA
where (to_char(lastchange,'YYYY') = '2004')
and (value <> '0.00'
or obtained <> '0.00'
or changed <> '0.00')
and prodid not in (select prodid from tableB
where to_char(updatedate, 'YYYY') = '2004'
and fieldcorrect in ('value' , 'obtained' , 'changed' ))

This query gives me 22 records. I know that TableB contains 14 more records. I am using this query to create a recordset in ASP.

How can I create a query that does this?

thanks
Reply With Quote
  #2 (permalink)  
Old 02-17-04, 16:53
frankyvalley frankyvalley is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
Sorry, here is the sql statement that will yield me the other 14 records:

select prodid from tableB
where to_char(updatedate, 'YYYY') = '2004'
and fieldcorrect in ('value' , 'obtained' , 'changed' )


thanks again,
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