323 questions
0
votes
0
answers
39
views
Multiple widget used same key
I have a persistent navbar component for navbar. Getting duplicate key error when logout and login. if we switch tab error is gone
════════ Exception caught by widgets library ═════════════════════════...
0
votes
0
answers
90
views
MariaDB Is there a syntax to update the values with ONDUPLICATE without having to rewrite all columns
I have to update a existing record e.g.
INSERT INTO table_name (column1, column2, column3)
VALUES (value1, value2, value3)
ON DUPLICATE KEY UPDATE
column1 = VALUES(column1),
column2 = VALUES(...
0
votes
1
answer
504
views
How to retrieve ids of inserted or updated rows after "INSERT ON DUPLICATE UPDATE" MySQL?
I'm storing players of my game based on their level :
CREATE TABLE IF NOT EXISTS Player(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL UNIQUE,
level TINYINT UNSIGNED ...
0
votes
1
answer
51
views
php 8.1 + mysql 5.7: error handler in stored procedure dosen't work
I have a stored procedure with which I try to insert some data into two tables but I don't want to insert duplicate keys. So I wrote the following procedure with the handling of error 1062: duplicate ...
0
votes
1
answer
65
views
Google sheets: How to merge two Google sheets with duplicate keys?
I have two sheets, each containing a table with duplicate keys. I want to create a third sheet that merges these two tables such that each row represents a cross-product of the data for each key.
Here'...
-1
votes
3
answers
68
views
Mysql on duplicate key condition (IF) setting of one field
I am using on duplicate key to update data in a mySQL DB v 8.0.35 (AWS RDS instance)
I want to update a selection of fields with the new value. Plus set a further field (up[dated) to 1 only if a ...
0
votes
1
answer
47
views
mysql ON DUPLICATE KEY UPDATE, check 2 columns at a time
Let's say there are 4 columns in my table
ID int(11) AI PK
BANK_ID int(11)
BANK_BRANCH_CODE varchar(255)
BANK_BRANCH_NAME varchar(255)
I want to UPDATE the BANK_BRANCH_NAME if the combination of ...
-2
votes
1
answer
63
views
SQL copy and paste table data into that same table by only changing one value
I want to copy and paste table data into that same table by only changing one value
Example: BillingLocationID
It's not possible to do it one by one inserting there are large number of rows.
I've ...
0
votes
1
answer
112
views
How to get actual value for duplicate index MongoDB?
I am interacting with MongoDB using C# driver. It threw duplicate key error like below for one index
the highlighted value 0x141214141a24 is not a actual value in the error message of location.path. ...
-2
votes
1
answer
44
views
mysql version 5.7.39 query problem condition with on duplicate
hi everyone i need help
create table wishlist
(
userID int null,
wishlistData longtext collate utf8mb4_bin not null,
constraint userID
unique (userID)...
0
votes
1
answer
969
views
Operand should contain 1 column(s) when trying to update one column
I have a table2 which has a composite primary key built from two columns, one of which is a foreign key from another table called table1, and the other is called position.
The table has a third column ...
0
votes
1
answer
118
views
Optimize MySQL on duplicate key update with conditions to update
I have a working solution, but I'm not sure this might be the best solution.
My goal: there's a table (testtable) with a column status. When the current status is 'CXL' and a insert query is run, the ...
0
votes
0
answers
121
views
On Duplicate Key Update with Greatest Value
I have 4 rows in my SQL table. id, tokenid, score and time.
If a player is playing the game for the first time, I can save it to the database.
If a player replays and collects more points than when ...
1
vote
1
answer
825
views
How to fix VALUES() deprecation notice in INSERT, ON DUPLICATE KEY UPDATE in MYSQL
VALUES() gives a deprecation notice in mysql 8.0 when used in a query like this
INSERT INTO foo (bar, baz) VALUES (1,2)
ON DUPLICATE KEY UPDATE baz=VALUES(baz)
This post showed how to fix it if you ...
2
votes
1
answer
327
views
Pandas: Split dataframe with duplicate values into dataframe with unique values
I have a dataframe in Pandas with duplicate values in Col1:
Col1
a
a
b
a
a
b
What I want to do is to split this df into different df-s with unique Col1 values in each.
DF1:
Col1
a
b
DF2:
Col1
a
b
DF3:
...
0
votes
0
answers
113
views
MYSQL PARTITIONS BY TIMESTAMP COLUMN
I have table with partitions by timestamp column (milliseconds). Theoretically it is unlikely to coincide, but can make the case that 2 inserts try to made with the same timestamp. Obviously it would ...
0
votes
0
answers
17
views
ON DUPLICATE KEY UPDATE - How to check if a row has been updated then trigger a column to insert modified date? [duplicate]
I insert my data using INSERT INTO SELECT then I have ON DUPLICATE KEY UPDATE like this:
ON DUPLICATE KEY UPDATE
first_name = COALESCE(eb.first_name, employee.first_name),
middle_name = ...
-1
votes
2
answers
721
views
How do i increment a value of column with condition?
my table looks something like this
id effect1(int) effect2(int) effect3(int)
1 0 1 5
2 1 0 0
i have a function, which return 1to3 int value ...
2
votes
1
answer
2k
views
on duplicate key update in snowflake
How can I use insert statement with on duplicate key update like MySQL in Snowflake?
MySQL code :
INSERT INTO table (column_list)
VALUES (value_list)
ON DUPLICATE KEY UPDATE
c1 = v1,
c2 = v2,
...
0
votes
0
answers
79
views
Does ON DUPLICATE KEY UPDATE in MySQL cause extra disk space to be used?
We have a large table (around 100 million rows) that is often written to, and often updated rapidly (think an app that auto-saves state every x seconds).
All writes to this table currently do INSERT .....
0
votes
1
answer
733
views
MySQL ON DUPLICATE KEY UPDATE in NodeJS
I'm using NodeJS with MySQL and async/await statements. I've got a UNIQUE column in a MySQL table named audioid.
I need to check if an audioid exists. If so I need to update a row. If not I need to ...
0
votes
2
answers
78
views
on duplicate key with a where condition
I am trying to use a WHERE condition on an INSERT INTO statement that contains ON DUPLICATE KEY. An example of what I'm trying to achieve is below.
This SQL statement is being called by third-party ...
0
votes
0
answers
127
views
How to insert...on duplicate key update (MySQL) after a condition same as IF() condition
I am implementing a situation when the INSERT ...ON DUPLICATE KEY UPDATE needs to be executed only after an IF condition is satisfied.
I am having issues on how to include the condition statement. ...
0
votes
0
answers
188
views
MySQL INSERT INTO ON DUPLICATE KEY UPDATE non sequential id
I have this table:
CREATE TABLE `test` (`id` INT(11) NOT NULL AUTO_INCREMENT , `name` VARCHAR(100) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
| id | name |
| -- | ---- |
In which I insert the ...
0
votes
1
answer
56
views
unique objects by value and extra filter within an array of objects
I am trying to get unique objects within an array of objects. Let's say the object is like below.
values = [
{ id: 10, available: true },
{ id: 10, available: false },
{ id: 11, ...