Skip to content

Tag: sql

How to get the count of GROUP BY query?

How can I get the count of a GROUP BY SQL query? This means I has displayed group by house number. I want the count of this group of house numbers. Answer This is only a guess, this would count number of voters per House No., like: And if you want to include the YadiNo (whatever does this mean), you

Duplicate check using SELECT or rely on unique index?

Using SQL Server 2012. I want to insert unique strings into a table. I always want to return the row ID of the unique string. Now, this can be accomplished in two ways. Which solution is the best? This is the table in question: Solution 1: SELECT first to check if the string exists. If it does, return its ID.

Drop Several Tables at Once

I have some tables that I need to drop on a regular basis. The names of the tables sometimes change but the table names always begin with ‘db_comp_temp’. Is it possible to write some SQL that will in effect do something like: Thanks in advance, Answer No, there is no wildcard support in DDL. Or: Y…