Skip to content

Tag: sql-server

SQL Query rounding issue

I am using pyodbc to fetch total quantity of a product based on a certain criteria called “Strength”. The “Strength” column also has string value for some records, so it is a varchar column. The user enters details like brand, product type, product line, date range, minimum quantity (i…

How to increment column by one group wise

I have a table called productLocation, and its data structure as follows, SQLFiddle For each location have its own sorting order for products. But some of the products have 0 as the SortValue Now I need to write a query to update SortValue as, If I consider one location, FkLocationId = 1 In the above data tab…

Last record per transaction

I am trying to select the last record per sales order. My query is simple in SQL Server management. The problem is that this database has tens of thousands of records, as it tracks all SO steps. I would to see the most recent record per the SO Answer Well I’m not sure how that table has two Name columns…