I am trying to extract the last hour (TKT_DT) record for number of tickets (TKT_DN) from sales table (PS_TKT_HIST) for specific date (BUS_DAT). I have the following code but it extracts the number of tickets (TKT_NO) for each hour. I want to filter the last hour only. Here is the code I used: I get the flowing results I want
i a new user and a new in React world. I need help to solve this situation about a Select with values from mysql DB. I receive the values, but the select goes in infinite loop. The error is surely in this file cause server.js works without problem!! Really thanks for the help, and sorry if it could be a
DB-Fiddle Expected Result: I want to calculate the total difference of the quantity between two timestamps. Therefore, I tried to use the query from this question: However, I am not able to get the expected result. What do I need to change to make it work? Answer The partition by clause in the lag call of your query is redundant.
I have a very simple data structure with just 3 tables: requests employees teams Basically, what I need is to concatenate 2 different SQL selects into one (so that the query could return just one row). If there’s an employee associated with a request, then return their name (title) and concatenate it with ‘ / ‘. Then, if there’s a
I’m trying to write a select statement in MySQL to get 5 rows after I get my match then sum how many times those numbers were repeated. Example: Raw Table id number 1 1 2 0 3 9 4 14 5 11 6 0 7 3 8 4 9 10 10 9 11 0 12 5 13 3 14 11
Thank you for reading! I want to find any value (“Name”), but I don’t want that value if it exists on the same row as a “Type” that equals “Z”. As an example, in the table below, I want all Sam and Joe records, but I do not want any Bob records, because one of the rows that Bob exists
I would like to have a select query, where I get all the games that a specific user played with the points of his and the opponents team. Entity relatioship model of my database This is my current query: The current query gives me this result: userId gameId won points 1 1 true 19 Problem: From this query I only
I have used SqlDataSource and have a select query based on District & Zone as below It’s an inline query. I have tried above query but not able to figure out how to Select condition based. I want if district supplied then Select according to District, if both District & Zone supplied then Select according to both & If nothing
I have the following data in SQL. Is there a way using SELECT QUERY that we can replace the NULL values in DATE column based on the REF values? Like replace the NULL values with the first available date for matching REF value, without making any change to the database. Expected Result Answer You can do it with MAX() window
I have three tables. For example: newTable: oldTable: associativeTable: What I want to do now is: I want to move the name column from oldTable to newTable. I have already altered newTable and added an empty name column. Now I’m trying to write a correct INSERT INTO statement. What I have so far is: I’m a bit lost on it.