Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Question

Status
Not open for further replies.

mark1110

Programmer
Apr 20, 2005
85
US
I am updating a table and I am not sure update it based on a condition.

I want to update from table1 to table2. Table1 has a field called term, it is either a Y or N. Table1 also has a term_date field. Table2 has two date fields, term1 and term2. I want to update term1 or term 2 on table2 with term_date from table1 based on whether term is a Y or N.

if term = Y
update term1 with term_date
end if

if term = N
update term2 with term_date
end if

I can't for the life of me figure out how to do this. Can anyone help?


Thanks,

Mark


 
update syntax varies from dbms to dbms

an ANSI SQL solution is probably not the easiest way to solve this

what dbms are you using?

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top