Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
1 answer
1k views

Convert columns into rows for use with indexed/materalized view

I'd like to convert columns into rows for a given SQL Server table. The table effectively is an audit table; it stores a given old and new value in separate columns for a given user attribute (e.g. ...
user3621633's user avatar
2 votes
1 answer
1k views

Refactoring subquery to JOIN and CROSS APPLY, get only one row for each record in parent table

Given the following query: SELECT p.ProductName, CASE WHEN EXISTS(SELECT 1 FROM Product WHERE ProductSuperID = p.ProductSuperID AND HasImage = 1) THEN 1 ELSE 0 END ...
Marc.2377's user avatar
  • 187