select data from 2 different rows into 1 | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

select data from 2 different rows into 1

I have a table which contains all of the booking information. I need to be able to extract information from this table IE # passengers, sales, etc for 2 different date ranges but have the data returned in one row for a comparison report. The report write I am using can only work with 1 select statement Is it possible to get sales for 2 different date ranges, but have it returned 1 one row?
quote:Originally posted by mikel4538 I have a table which contains all of the booking information. I need to be able to extract information from this table IE # passengers, sales, etc for 2 different date ranges but have the data returned in one row for a comparison report. The report write I am using can only work with 1 select statement Is it possible to get sales for 2 different date ranges, but have it returned 1 one row?

JOIN? Thanks, Name
———
Dilli Grg (1 row(s) affected)
"I need to be able to extract information from this table IE # passengers, sales, etc for 2 different date ranges but have the data returned in one row for a comparison report. The report write I am using can only work with 1 select statement"
select *
from tbl
where ( date >= @date1_start
and date <= @date1_end)
or ( date >= @date2_start
and date <= @date2_end) KH
I created a view that uses a join, that seems to work. Thanks for your help
]]>