I have three tables in MySQL v5.6 created by: CREATE TABLE tm ( id INT AUTO_INCREMENT, PRIMARY KEY (id) ); CREATE TABLE th ( id INT AUTO_INCREMENT, PRIMARY KEY (id) ); CREATE TABLE tr (…
Tag: sql
SQL : get number of user but order date [closed]
I trying to get how many user i got in a precise day compared to the first order for exemple : “2020-02” = 20, “2020-03” = 20 … etc… I did an sql query like that : SELECT o….
How can I modify the value of an element of my gridview before update in database?
I have a gridview but I want to update a cell value before the update in the database but it doesn’t work In the .aspx file: In the .aspx.cs file: I try to update the row before insert in database with OnRowUpdating but it doesn’t change the value. Someone have any idea how to do it ? Answer I hav…
How to get data for past X weeks in redshift?
I have a below query which I run gives me the single count for previous week which is Week 44. Current week is 45 as of now. with data_holder as ( with tree_post as (Select contractid as conid, max(…
Token unkown error in stored procedure when updating on external database
I am using Firebird and I want to create a stored procedure to do an update in another database and I do not understand what I am missing because when compiling it gives me the following error: can’t format message 13:896 — message file C:WINDOWSfirebird.msg not found. Dynamic SQL Error. SQL error…
Problems with JPA Hibernate Query with ‘Interval’
I need the possibility to retrieve the orders for the past 6 months for my backend application. After some research , I’ve found out that JPA does not support the INTERVAL definition. Is there a workaround for archiving this particularly function ? Answer In that case use the JPA provided functionality …
How to use sum in where clause in SQL?
I want to execute this query: Select Environment, SUM(Scores) as `Scores`,SUM(Clicks) as `Clicks` from Example.table where Scores > sum(Scores) group by Environment But it …
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…
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 …
STUFF function truncated result
I am trying to generate dynamic sql by querying a table and using the STUFF function and returning the results into a variable (DECLARE @dynamic_query NVARCHAR(max)). My problem is that the results returned by the STUFF function are truncated/incomplete. The content of @dynamic_query will be cut short. I can&…