Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. create TABLE #Temporary_tbl
  2. (
  3. ProductColour VARCHAR(50),
  4. ProductSize VARCHAR(20),
  5. )
  6.  
  7. insert into #Temporary_tbl (ProductColour)
  8. select distinct productcolour
  9. from shoptransfer
  10.  
  11. insert into #Temporary_tbl (ProductSize)
  12. select distinct ProductSize
  13. from shoptransfer
  14.  
  15. select * from #Temporary_tbl
  16.  
  17. select distinct ProductColour, null as ProductSize
  18. from shoptransfer
  19.  
  20. union all
  21.  
  22. select distinct null as ProductColor, ProductSize
  23. from shoptransfer
  24.  
  25. SELECT DISTINCT
  26. CASE x.f WHEN 1 THEN s.ProductColour END AS ProductColour
  27. CASE x.f WHEN 2 THEN s.ProductSize END AS ProductSize
  28. FROM shoptransfer s
  29. CROSS JOIN (SELECT 1 UNION ALL SELECT 2) x (f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement