Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Using "If" Logic Within "Select" Statement


Message #1 by rg1@h... on Wed, 3 Oct 2001 16:09:05
Hi.

I have no idea how to code a SQL statement that will insert rows from 
Table1 into Table2 and if a particular column from Table1 has a value, 
then the corresponding column in Table2 has a different value.

e.g. Table1 has 2 rows. Column1 has a value of "A" for row1 and "B" for 
row2. In Table2, I need column1 to have a value of "C" for row1 and "D" 
for row2.

In other words, I need some "IF" logic within the SELECT statement.

INSERT INTO Table2
    SELECT column1, column2, etc. FROM Table1.

TIA.

Rita

  Return to Index