i have two query as follows
select top 1 Total_Seats from batch_seats where cbm_batch_id ='B5176 '
When i run the above query output as follows
Total_Seats
24
select top 1 Avil_seats from batch_seats where cbm_batch_id = 'B5176'
When i run the above query output as follows
Avil_seats
6
Using the above two query i want output as follows
Booked Seats
18 (Total_Seats 24 - Avil_seats 6)
for getting output 18 how can i write the query.
Please help me.
Regards,
Narasiman P.
select top 1 Total_Seats from batch_seats where cbm_batch_id ='B5176 '
When i run the above query output as follows
Total_Seats
24
select top 1 Avil_seats from batch_seats where cbm_batch_id = 'B5176'
When i run the above query output as follows
Avil_seats
6
Using the above two query i want output as follows
Booked Seats
18 (Total_Seats 24 - Avil_seats 6)
for getting output 18 how can i write the query.
Please help me.
Regards,
Narasiman P.
Ramchand RepallePosted Nov 27, 2014, 5:06 AM
I hope this below query will helps you to get the result.
select top 1 (Total_Seats - Avil_seats) AS 'BookedSeats' from batch_seats where cbm_batch_id ='B5176'
Thanks,
Ramchand.