Skip to main content

Timeline for Re-write a query in SQL Server 2012

Current License: CC BY-SA 4.0

3 events
when toggle format what by license comment
Feb 24, 2023 at 18:50 comment added Andriy M @lifeisajourney: I think I understand. But I don't believe there's reason for you to worry. SQL is a declarative language. Your primary concern should be to tell the server what you want, in as clear a way as possible, leaving the engine to figure out how to achieve the result in a most optimal way. Sometimes your query might be too slow and you have to take measures. Usually you do so when the problem is evident, though. Until then, focus on clarity and maintainability. As it is, my alternatives might even be unnecessary if your current query hasn't caused any actual performance issues.
Feb 24, 2023 at 14:32 comment added lifeisajourney Thank you! The solution provided faces the same issue I was trying to avoid i.e. accessing all the product versions. If an order has 5 products of type holder and mandatory = 1, as soon as I find the first product version with that criteria I want to stop further processing for the other versions in that order. For eg, order 1 has products 1,2,3,4,5. Let's say product 1, 3, and 5 have product versions with type holder and mandatory=1 and nothing else. When I find product 1, I want to stop right there instead of counting the versions of 3 and 5. Does that make sense?
Feb 24, 2023 at 12:06 history answered Andriy M CC BY-SA 4.0