I have two table, one for products, and one for discounts. Discounts table look like: ID | Name | Percentage | Product Name Search Param ——————————————————-…
SQL “all in” group by
I’m having troubles with some sql statement. I have a table like this: I couldn’t find any SQL form to do that but I want something like this: SELECT Col1, CASE WHEN all(Col2 in (‘A’,’B’,’C’…
How can I use a list of variables in the “EXECUTE STATEMENT USING” statement MySQL?
I have the below procedure – DELIMITER $$ DROP PROCEDURE IF EXISTS testInjection $$ CREATE PROCEDURE testInjection(IN groupList LONGTEXT) BEGIN SET @groupList = groupList; SET @QUERY = “SELECT * FROM …
SQL transaction with JS Array of Objects?
Say i have an Array of Objects Now i create a comma seperated list To pass it to sql.transaction? is there any other way then to loop through the array and pass object each by one or can i pass bulk array? When i pass the comma_seperated_list_response it says Error object Object Answer If every object into yo…
Distinct vs row_number() – query with same condition giving different result in oracle?
I am trying to eliminate duplicate based on combination of three columns on the same table with some filter conditions through two different approaches but for some reason the result of both are …
Select all columns but ignore records having duplicate values on some of them
Let’s say I have a cars table. It has following columns: id, color, engine, price, upholstery, model_name. So far I’ve been querying for all cars based on criteria passed from the front end app. …
PROCEDURE Return always 0 for string statement
I have a procedure that can be changed dynamically by user for multi column and I write it in SQL when I run it. Everything is OK in SQL and Server Explorer in Visual Studio but when I want use it in …
Teradata Parsing Full Name field sql
I have a column with a name value with a data type of char(64) LATIN in a Teradata table. The values look like ‘SMITH JOHN J ‘, ‘Doe Jane Anne ‘, etc. The spaces between the …
MYSQL : Group count specific column per user?
I want count column per specific user, using data from 3 tables. TABLE 1 (users) : SAMPLE : TABLE 2 (data) : SAMPLE : TABLE 3 (access): SAMPLE : What i tried so far : Result : I what to link it with user name alse, Desired Result : Answer Seems you need also a join for users and as
Getting a distinct value from one column if all rows matches a certain criteria
I’m trying to find a performant and easy-to-read query to get a distinct value from one column, if all rows in the table matches a certain criteria. I have a table that tracks e-commerce orders and …