Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unanswered: 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

  2. #2
    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •