Skip to content

Remove duplicate based on 2 rows value

So I have a database with more than 2000 line and I wanted to delete the duplicate value based on 2 rows.For Example : no server name 1 serv1 a 2 serv1 b 3 serv1 …

SQL Server Information_Schema

I want to check a table’s primary key by SQL statements, I use below SQL: SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = ‘PRIMARY KEY’ AND TABLE_NAME = ‘…

Already inserted data replace into another UserId

In my Business unit table FK is the UserId ex: UserId =001, BusinessUnit = Bangalore ex: UserId =001, BusinessUnit = Hyd …. Now, I need UserId = 002 is different I want to create same data into 002 The INSERT statement conflicted with the FOREIGN KEY constraint “FK_UserAccess_UserDetails”. T…

My SUM with cases seems to be repeating twice

I have some camp management software that registers users for a camp. I am trying to get how much a user owes on their account based on how much a camp costs and whether they are using the bus, and …

A reverse IN statement?

I feel like I am either overthinking this or it’s not possible but is there a way to do something like a reverse IN statement in SQL? Instead of saying: WHERE column_name NOT IN (x, y, z) I want to …