This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 7th, 2013  |  syntax: None  |  size: 1.01 KB  |  views: 56  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SELECT
  2.     [Theme].[Name], [ThemeType].[Type]
  3. FROM
  4.     [Theme]
  5. LEFT OUTER JOIN
  6.     [ThemeType] ON [Theme].[ThemeTypeId] = [ThemeType].[PK_ThemeType]
  7. JOIN
  8.     [ProductTheme] ON [ProductTheme].[ThemeId]=[Theme].[PK_Theme]
  9. WHERE
  10.     ProductTheme.ProductID LIKE '%'
  11.     AND ProductTheme.ThemeId = Theme.PK_Theme
  12.     AND COALESCE([THEME].[THEMETYPEID], 'null') LIKE '%[0-9]%'
  13. ORDER BY
  14.     CASE WHEN [THEMETYPE].[TYPE] IS NULL
  15.          THEN 0
  16.          ELSE 1
  17.     END,
  18.     [THEMETYPE].[TYPE]
  19.        
  20. WHERE ProductTheme.ProductID = 1
  21.        
  22. WHERE ProductTheme.ProductID LIKE '%'
  23.        
  24. SELECT DISTINCT [Theme].[Name], [ThemeType].[Type]
  25. FROM [Theme]
  26. LEFT OUTER JOIN [ThemeType]
  27. ON [Theme].[ThemeTypeId] = [ThemeType].[PK_ThemeType]
  28. JOIN [ProductTheme]
  29. ON [ProductTheme].[ThemeId]=[Theme].[PK_Theme]
  30. WHERE ProductTheme.ProductID LIKE '%' AND ProductTheme.ThemeId = Theme.PK_Theme AND COALESCE([THEME].[THEMETYPEID], 'null') LIKE '%[0-9]%'
  31. ORDER  BY CASE WHEN [THEMETYPE].[TYPE] IS NULL
  32. THEN 0
  33. ELSE 1
  34. END,
  35. [THEMETYPE].[TYPE]
clone this paste RAW Paste Data