Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Feb 25

Written by: Steve Gray
2/25/2011 8:42 AM  RssIcon

I’ve almost got the CTE syntax memorized; as I start to do more work on SQL 2005+. But not quite, I still have to Google to be sure I have it right. So, to make that easier, here is a simple example of CTE syntax to get the ball rolling.

 

Code Snippet
  1. WITH ProductAndCategoryNamesOverTenDollars (ProductName, CategoryName, UnitPrice) AS
  2. (
  3.    SELECT
  4.       p.ProductName,
  5.       c.CategoryName,
  6.       p.UnitPrice
  7.    FROM Products p
  8.       INNER JOIN Categories c ON
  9.          c.CategoryID = p.CategoryID
  10.    WHERE p.UnitPrice > 10.0
  11. )
  12.  
  13. SELECT *
  14. FROM ProductAndCategoryNamesOverTenDollars
  15. ORDER BY CategoryName ASC, UnitPrice ASC, ProductName ASC

Tags:
Categories:
Location: Blogs Parent Separator DEVSHED Blogs Child Separator SQL
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us