Home > DEV > SQL Tips

SQL Tips

A few tips useful for your Sql Query…

Update with a join:

   1: UPDATE MyTable

   2: SET Column = NewValue

   3: FROM MyTable

   4: INNER JOIN OtherTable ON MyTable.Key = OtherTable.Key

trimming…

   1: select LTRIM(RTRIM(columnOne)) from table1

select into

   1: SELECT Persons.LastName,Orders.OrderNo

   2: INTO Backup

   3: FROM Persons

   4: INNER JOIN Orders

   5: ON Persons.P_Id=Orders.P_Id

Advertisements
Categories: DEV Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: