Skip to content
Advertisement

DB2 leading zeroes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question How to trim only zeroes in a leading position in a string? I’m writing a DB2 script that removes all leading zeroes from a string that

How to select the immediate characters BEFORE a specific string in SQL

So imagine I have a SQL tempTable with a text field with 2 pages worth of text in it. pkid text 0 This is an example text with some images names like image1.svg or another one like image2.svg 1 This is another example text image3.svg and several images more like image4 and image5 What I want to know is if

Time difference between start/stop interactions

I have two tables in my database that looks like this learner_lessons learner_lesson_logs Basically, when a user clicks on a video it starts playing and the interaction is recorded as ‘Start’ and a timestamp is created accordingly. Now when a user pauses the video another interaction ‘Pause’ is created and the timestamp is recorded. The user might come back later

SQL want efficient query to SELECT columnA, columnB FROM table1 WHERE both columnA, columnB are in columnC FROM table2 WHERE columndD > value

I’m searching for a more efficient method to accomplish something that I’ve already solved with a few different SQL statements. The problem: I have two tables a transactions table, and an accounts table The transactions table has columns that look like: acct_sending acct_receiving amount tx_datetime 100 101 10 yyyy-mm-dd hh-mm-ss 101 100 5 yyyy-mm-dd hh-mm-ss 101 200 1 yyyy-mm-dd hh-mm-ss

How to pass an SQL function on bulk insert query in node

I have to execute an INSERT INTO query using mysql or mysql2 in node.js The values passed into the query utilizes a spatial geometry function ST_GeomFromGeoJSON() on geoMap column which is of type GEOMETRY. Here is the simplified code: The above code does not work and throws the error Cannot get geometry object from data you send to the GEOMETRY

Insert with Foreign Key Contraints

In the above code, I want to add the distinct values from column make from vehicles into column makeID in makeModel but I get the error INSERT INTO makeModel (makeID) SELECT DISTINCT (make) FROM vehicle Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`dealership`.`makemodel`, CONSTRAINT `makemodel_ibfk_2` FOREIGN KEY (`modelID`) REFERENCES `model` (`ID`)) Answer

Advertisement