I have a problem related to sql language. I am trying to add the auto_increment features to a pre-existing row with the primary key attribute. What I get back is : Error Code: 1833. Cannot change column ‘ODB_ID’: used in a foreign key constraint target_ibfk of table ‘test3.target’. The…
Tag: sql
Truncated incorrect INTEGER value on CREATE TEMPORARY TABLE
I get this error([Err] 1292 – Truncated incorrect INTEGER value: ‘Z001’), when create temporary table vacunas2. I’m using MySql Answer This does not make sense: Perhaps you intend:
Querying JSONB array value for sub values?
I have a JSONB Object: It is stored in a jsonb column of a table So i was trying to get a count by name of devices which have interfaces that are not ‘up’. Group By is used for developing counts by naame, but i am having issues querying the json list for values. MY first Attempt was: Some surround…
Conditional join on soonest date – SQL Server 2017
I am working with two tables: tblOrders and tblPOs I am trying to join these two tables, and for each order, select the PO with the earliest arrival date (in the event there is more than one). So for Order Number 10244, it has two POs, PO99455 and PO99456. I would want PO99456 to be associated, since it’…
Python return error when trying to send a MySQL query that contains MySQL variables
I am trying to retrieve data from a MySQL database by sending a MySQL query using Python. When I send the MySQL Query in MySQL workbench, it runs perfectly fine. When I try the same using Python (in a Jupyter Notebook), it returns an error. Python Code: Error: If I remove the variable in the MySQL Query it ru…
Finding double bookings
I have two tables which when linked by a booking ID from table 1 and ID from table 2 Therefore Im trying to flag double bookings where the same member id has booked twice within a time frame (StartDateTime and EndDateTime). Then remove the booking that has the latest BookedDate. Can someone help me with a sql…
Django: Really slow RunPython migration on related models
I am trying to optimise the speed of a migration on a large table (250K objects). The goal is to add to each row a user field based on the user of an object related to this row: I tried using an F expression but sadly django won’t allow relations in them. Note that I am mostly a beginner in
Count based on multiple conditions using sqldf
Hi all I’m writing a sql query on R using sqldf and seem to hit a roadblock. I have a table with an Id column, two dates columns and a grouping by column. The query I’m writing is From this query the result I’m getting is Whichis correct based on the query. What I want to achieve is if my
Syntaxerror in CREATE TABLE without any table creation but in procedure creation
I’m using Microsoft Access 2003, new to SQL tho. I have no idea why this wouldn’t work, google won’t help me either. The table “K_Lehrer” exists, and the code I have here is the only thing I wrote. My code is Error (translated): syntax error in create table statement error with c…
Oracle SQL merge tables side by side
I have 3 select queries which i would like to merge side by side. The common column is name. I dont want to use UNION ALL solutions since my select queries might have many columns. name columna e1 1 name columnb h1 2 name columnc t1 3 The output i am looking for is: name columna columnb columnc e1 1