Facebook
From Walloping Baboon, 6 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 134
  1. // rowscat is a CTE
  2.  
  3. rowscat AS
  4.  (SELECT RowId FROM base
  5.   WHERE Value = whatever
  6.  )
  7.  
  8.  // If the QS is 'enf', 'med' or 'AO' I need this:
  9.  
  10. rowscat AS
  11.  (SELECT RowId FROM base
  12.   WHERE Value = @Url_QScat
  13.  )
  14.  
  15.  // If the QS is NULL or any other value I need this:
  16.  
  17. rowscat AS
  18.  (SELECT RowId FROM base
  19.   WHERE Value IN('enf', 'med','AO')
  20.  )