Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 sum total seat of cinema

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2014-10-15 : 04:38:29
Hi:

select count(*), tbf.film_strtitle
from tblTrans_Ticket tr inner join tblsession S on s.Session_lngSessionId = tr.Session_lngSessionId
inner join tblFilm tbf ON tbf.Film_strCode = s.Film_strCode

I want to sum the seats. What i have here is the strtitle of every cinema. The issue here is that a film will play in multiple screens, so i could get results like:

10 film1 screen1
13 film1 screen2
33 film2 screen1
etc.

sz1
Aged Yak Warrior

555 Posts

Posted - 2014-10-15 : 05:05:48
Do you mean you just want the total seats no matter what cinema? one figure result:

10 film1 screen1
13 film1 screen2
33 film2 screen1

Total Seats = 56?

We are the creators of our own reality!
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2014-10-16 : 03:08:32
Hi.
Exactly.
Go to Top of Page

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2014-10-16 : 13:40:13
So
select count(*) 
from tblTrans_Ticket tr inner join tblsession S on s.Session_lngSessionId = tr.Session_lngSessionId
inner join tblFilm tbf ON tbf.Film_strCode = s.Film_strCode;

does not give you the number you wish?


djj
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2014-10-19 : 12:37:53
I also need the column with the individual films.
So
10 film1 screen1 --- Total Seats = 56
13 film1 screen2 --- Total Seats = 56
33 film2 screen1 --- Total Seats = 56
I don't mind the multiple sum.
Go to Top of Page
   

- Advertisement -