I want to have the number of open requests for each month before the 1st of each month. I use ComboChart and my orange line is, at the moment, the average for the 6 past months, I want to change this data for the opened requests. Exemple : for April, I have 2 new requests and 1 closed request and
Tag: sql-server
Compare procedure Definition within two databases
We have an instance of Sql Server 2012, In the Instance we have 2 dbs called A and B ( Assume A as production DB and B as Development DB and B is the exact copy of Database A ) suppose For Development Purpose,Some procedure ( Already Existed,Not Newly Created ) definition were changed in database B but not in
SQL join 2 times same table
I have a flight table like CREATE TABLE flight (id int, name varchar(25), origin int, destination int); INSERT INTO flight (id, name, origin, destination) VALUES (1, ‘Alpha’, 1,2); INSERT INTO flight (…
Write a SQL query to calculate the balance in a card [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Can you please help me how to calculate the balance for each quarter The data table Script to…
SQL – Splitting string in multiple columns
I’d like to split the result from a query and display the values in separate columns. As an example I get the following result I want to split the values by ‘_’ and add them to separate columns. The query result should look something like this So far I can split the result. But for each valu…
Tired of typing SQL scripts like “SELECT TOP 10 * FROM” and other similar scripts. How to create an alias/shortcut in SSMS?
While doing a lot of research at my work I keep writing generic scripts like “SELECT TOP 10 * FROM” etc. Is there a way to for me to write something like a snippet so that when i type “ss” + Space/Tab it will insert the “SELECT TOP 10 * FROM” script? I have a number of scri…
How to Split 2 Strings and insert in to 2 columns
I have 2 strings Declare @WhenDetails NVarchar(Max) =’07:00:0:0;1:00:1:0;6:00:1:0;10:00:1:0;’ Declare @Dosage NVarchar(Max) =’1.00;2.00;1.00;1.00′ I need to split these 2 string and insert into a …
Get TOP 1 row from multiple tables based on date
I have five tables in a SQL Server database. These tables are listed below and I want to select Data from these tables according to date. I tried searching but could not find solution for multiple tables. Please help TABLE1 TABLE2 TABLE3 TABLE4 TABLE5 I want to select Label and Date from Table 3, 4 and 5 wher…
Covert Access Cross tab to sql
I need this converted to a SQL view. This is the code from MS Access: Any ideas how to re write this into SQL ? In products I have id, BelsCategoryID. In Categories, I have ID. In Sold, I have BelsProductID and year. – This table shows weather a product is sold in a given year. I want the result
Order by column having duplicates for aggregation
Employees Table Question: Why does ordering by a column having duplicates produce final values instead of intermediate values? For e.g. when this query is executed, 3 employees having salary = 5000, the final value i.e. the value that should be produced for the 3rd employee is produced for the 1st? Answer SQL…