Nouman Zakir

while (true) { Post.NewArticle(); }
posts - 16, comments - 25, trackbacks - 0

My Links

News

Archives

Post Categories

Personal Website

August 2009 Entries

Using SELECT statement to UPDATE records in SQL
You can use SELECT statement to update records through UPDATE statement. In the SET Clause use the SELECT statement along with desired filters to update the records. UPDATE tblDestination SET tblDestination.col=value WHERE EXISTS ( SELECT col2.value FROM tblSource WHERE tblSource.join_col=tblDesti... AND tblSource.constraint=value)...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, August 04, 2009 6:28 AM | Feedback (0) | Filed Under [ SQL ]

Using SELECT statement to INSERT records in SQL
In INSERT statement, by replacing the VALUES clause with a SELECT statement you can get a set of records for INSERT. Suppose I have a table called table_A and I want to populate it with the ID, Name and Address of table_B. The statement would look something like this: INSERT table_A (col_id, col_name, col_address) SELECT col_id, col_name, col_address FROM table_B WHERE col_city = 'karachi' This will take the records with col_city='karachi' and load them into the table table_A. I can use any type...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, August 04, 2009 4:57 AM | Feedback (2) | Filed Under [ SQL ]

Powered by: