I want to compare the current date with a date from a database table. This code: DATE_FORMAT(dt,’%y-%m’) gives me a date like this 2020-10 and i want that this code: DATE_ADD(CURRENT_DATE, INTERVAL – …
Convert sql rows to single row multiple columns data
I have this structure in table TYPE DATE AMOUNT ID ——————————– B 30.6.2019 15 1 B 30.11.2019 20 1 C 22.12.2019 17 1 B …
How to write SQL command that automatically assigns values from an equation?
I have this table called Ingredients, with these attributes: create table Ingredients (ing_id int not null, ing_name varchar(40), preserve_time int, ing_bought date, freshness int, primary key (…
How to write a JavaScript stored procedure in Azure Cosmo DB to return data from SQL API
I’m trying to create a Cosmo DB stored procedure to return the results of a relatively simple SQL statement. If it were purely SQL I would be fine but since I know nothing about JavaScript I’m struggling mightily. Any help would be very much appreciated. Here is the SQL query: Answer You can try s…
Add a counter based consecutive dates
I have an employee table with employee name and the dates when the employee was on leave. My task is to identify employees who have takes 3 or 5 consecutive days of leave. I tried to add a row_number …
Estimated number of rows is way off in execution plan
I have a situation where the estimated number of rows in the execution plan is way off My columns in the join are varchar(50). I have tried different indexes but it does not reduce this problem. I …
Reporting off of an in memory data store? [closed]
I need to generate reports based on a dataset pulled from a third party API, but I can’t store the data on disk. (If not storing the data were not a requirement, I would be storing the data in a …
SQL Server string parse?
DROP TABLE IF EXISTS #test CREATE TABLE #test ( line VARCHAR(500) ) INSERT INTO #test (line) VALUES (‘1194125598,,191,3.95,194.95,Loan Payment,999999999,2779,”Melinda”,”Meeken&…
Node-MySQL unable to insert TIME
I am trying to build an API in Express.JS with an MySQL-Server running in the background. One of the tables contains a column with a type of TIME. When trying to insert into that table however, I get {…
Why can identifiers in SQL be referenced before assignment?
In a SQL query you can reference a name before that name has been declared. SELECT A.id FROM table_a A; What is the history of this behavior and how does it relate to programming languages that …