Why the following error (Can’t update table ‘table_b’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger) appears after i try to delete with inner join? Can i solve it? Answer I don’t see the point for a trigger here. The funct…
Tag: sql
MySQL Default Record from Table
I use MySQL 5.6 and I have 3 tables. Two of them are a list of data, and the third table is used for a relationship between them. In the third table I would like to identify a default record for each id1, so I added a column named predt to let me know which record is the default one.
Using regex in sql to define new variable
I need to derive the “new” column from the “old” column using sql and regex if possible. I’m using Oracle SQL Developer. If I were using regex in R or Python, I would use this recipe to get the “new” column: Thanks. Use this: Answer Here’s one option:
Django sql statements with non english symbols
I have sql statement, with non english symbols in where (sap_code variable contains russian text) sap_code = ‘ОВОЩИ – ФРУКТЫ’ sql_string = ‘SELECT ‘ ‘SAP_CODE, ‘ ‘SKU, ‘ …
SQL – How to avoid inserting duplicate rows from another table while matching multiple columns
Using Microsoft SSMS. There are two tables Table1 ID | SessionId | Handle | StartDate | ——————————— 1 | abcd | handle1 | 2020-08-01 00:00:00| 2 | abcd | …
SQL: Returning a list of unique values with respect to another value
I have a table that tells me the products as well as which state they’re sold in. PRODUCT | STATE ————————————————- yPhone | Alabama yPad | Massachusetts …
sql clauses using HAVING truncated value error for part of the string
I am getting an integer value error but don’t understand why. Warning: #1292 Truncated incorrect INTEGER value: ‘%accepted%’; Warning: #1292 Truncated incorrect INTEGER value: ‘%pending%’ . It does not have the error for processing. It doesnt matter what is in “1st position…
Count date if it is in the same months as the first order of the customer
DB Fiddle Expected Result My database consists of two tables returned and customers. In the customers table you can find the date of the first_order per customer. In the returned table you can find each return a customer has done so far. Now, I want to create a list and count all returned_dates which are in t…
oracle data base error ORA-00920 invalid relational operator
This is my code after check syntax this error appear ORA-00920 invalid relational operator What problem on this code? Answer Unless you have a function called region that accepts three string arguments, this code does not make sense: I assume that you are missing the in:
Timestamps and addition of weeks
My query requires me to find the number of people positive and their infectious periods which is plus and minus 2 weeks. In my query below I keep getting null in my 2 weeks Timestamp What is wrong with my equation and why won’t it add the 2 weeks in the next column? In DB browser this is the format