Skip to content

Tag: sql-server

SQL – How can I rewrite this request without many SELECT

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

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 (…

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