Skip to content

Tag: sql-server

SQL All Categorized Possible Combinations

I recently had a rather interesting problem to solve where I needed to construct a list consisting of a combined selection of one choice from each of an arbitrarily defined set of categories, and an aggregated total of a value associated with each choice. The choices within each category are also arbitrarily …

SQL View Select Optional

I have a view that the current output something like this The rules are as follows Each group can only have 2 code and always have a default code vs not a default code. IF default code is not null, then always show the row. Regardless if Non default code has value or not If default code is null, then

SQL Sum of Count Values

I have this query and I’d like to get a sum of the count values in the ‘membership count’ column. How can I get the sum of the count values? Answer If you want a last row with the sum then use GROUP BY ROLLUP:

sql find same two columns

i want to find all same a+b’s for that data my result should be * That works like that I can see which ones are like that. But I want to see RAW data. How can I see all data with that having clause ? Because that table have lots of columns and I dont want to group by them.