I need some help in a scenario that I am working on. I have two tables Product_Staging and Product. The contents of the table are below. Product_Staging: Account_No Product_No …
Tag: sql
Select consecutive rows under a certain value in MySQL
Selecting consecutive rows with a column under a certain value I have a table with the following data: crashID crash ———————– 1 189 2 144 3 8939 …
Dynamically selection of Column Name
I want to select Column Name which has non null and non zero value. So any column name which has 0 or NULL should not be displayed in the output grid I have the Source table as below I want to group by Col1 and Display Col1, MIN(Col2), MIN(Col3), MIN(Col4) and ColRes as (Name of the column with value more
How to use a table variable within EXECUTE command?
I have this code: DECLARE @mytable TABLE (x INT); EXECUTE (‘SELECT * FROM ‘ + @mytable); When I run the code, I get this error: Must declare the scalar variable “@mytable “. I know that @mytable …
SQL: How to group by with two tables?
I have the tables products and history and I need to group by name: products = (id_product, name) history = (id_history, id_product, amount) I tried this SQL query but it isn’t grouped by name: …
How to link Gatsby.js with my Express server
I am trying to make a very basic full-stack application where the front-end is Gatsby and the Backend is a simple Express server. I have a Database where I have some users and the goal is get these users in the backend with a query and then displaying them in the Gatsby (React) component using fetch(). Obviously something goes wrong
Find the most popular month for customers to order a certain product
I am trying to find out which month has the most orders for a certain product (Product HHYDP). This is my code so far, but each time I try to use GROUP BY and SORT BY functions related to my problem, …
Differences between OLAP and OLTP databases
What are the key differences between OLAP and OLTP databases. Specifically in terms of implementation (rather than use cases). OLAP is of course primarily used for reporting while OLTP is used for …
Why does a database query in python not return an integer value?
Why does this work: cash = db.execute(“SELECT cash FROM users WHERE id = :user_id”, user_id = session[“user_id”]) # Ensure user can afford the stock if cash[0][“cash”] < share * quote["price"]…
Datagridview update to multiple tables without using bindingsource or tableadapter
I have a working Select query but since it contains multiple tables I can’t update it from my datagridview. I’m sure it can be re-written to allow updates, but my SQL is quite limited. SELECT d….