Pages

Thursday 13 November 2008

Thursday - SQL Tips and Tricks

Before he ran to the post office to mail stuff that Carl Franklin had left behind, Stephen Forte demonstrated a few tips:
  • To write a fancy UPDATE statement that needs a complex subquery, use WITH (common table expression)
  • To keep 2 tables in sync with one single statement, use the new MERGE syntax (new in 2008).
  • To filter out the results of a ranking query without affecting the rank values, use WITH again.

No comments: