Skip to content

Tag: sql-server

Select Distinct and show records where X column is not the same

I have a database with a structure of: I am struggling to write a query to show me where ‘Supp’ is different. (Supp Should be the same for all records, So i need to identify records effected to correct) The table contains more than 55,000 lines Just a list of Codes where Supp is not the same for e…

How to Group By in SQL Server Query

I’m using this query to get the Sum of SaleAmount for each type (SOType) of Sale Invoices. I am getting the result but the result is not grouped by SOType. Have tried to use Group by Outside the query …

Grouping By Date When Used In Case

I’ve got a working query where I can export to Excel and pivot myself to not be grouped by the fldTrancationDateTime column and that is working fine as a short term solution. Is the only option here to use SQL pivot so I can only group by the Product and have each date range populated? Instead of one ro…