Union on two tables with a where clause in the one

Posted by Lostdrifter on Stack Overflow See other posts from Stack Overflow or by Lostdrifter
Published on 2010-04-08T18:42:52Z Indexed on 2010/04/08 19:13 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

Currently I have 2 tables, both of the tables have the same structure and are going to be used in a web application. the two tables are production and temp. The temp table contains one additional column called [signed up]. Currently I generate a single list using two columns that are found in each table (recno and name). Using these two fields I'm able to support my web application search function. Now what I need to do is support limiting the amount of items that can be used in the search on the second table. the reason for this is become once a person is "signed up" a similar record is created in the production table and will have its own recno.

doing:

Select recno, name
  from production
UNION ALL
Select recno, name
  from temp

...will show me everyone. I have tried:

Select recno, name
  from production
UNION ALL
Select recno, name
  from temp
 WHERE signup <> 'Y'

But this returns nothing? Can anyone help?

© Stack Overflow or respective owner

Related posts about sql

Related posts about union