Skip to content

SQL – Merge two rows with similar values

I have the following table called areas in a PostgreSQL server: So basically it’s nearly duplicate entries that have the same name and code, but different id, shape and created timestamp. What I want is to merge those duplicate rows, but overwrite the “shape” and “created” fields…

MariaDb InnoDB deadlock while doing many inserts

I’m having deadlock issues with a MariaDB (10.0.27)if it’s under pressure. The database schema is basically a hierarchy and the leaf node causes this: This is how my leaf table looks like: I’m able to reproduce the deadlock with an input set that puts the system under pressure. With this, I&…

Joining back on the same table in SQL server

I have a table like below And the output I require is The match is defined on the basis of PO number. If PO number exists in both the sources then it should be match else only in AAP and only in SNW respectively. Can this be achieved? Thanks, Ani Answer or

Excel SQL VBA: adding more than one cmd parameter

I am writing SQL-query, and I get error with string value: I tried to add more than one cmd parameter to solve this problem: But I also get an error. How do I set more than one cmd parameter and use it in my query? Table I am working with: here. Answer The parameter to CreateParameter are The Direction &#8211…

Stuck to select maximum row

I have a table with columns: I need to select row with maximum value, and show info like I tried using group function MAX(), but I can’t select fullname, because if I use it as a GROUP BY expression, it will select max in groups. Other way, is to use WITH statement, order table by value desc, use functi…