hi,
in my database i have the two tables...
1)programs 2)reserved
in the programs...two fields 1)program id 2)maxseats................these details wil be entered by admin
in the reserved table two fileds ..1)PRogramid 2)status
my requirement is .. i need the available seats..means
if any body is intersted in any program...they wil select the program...then status becomes approved(1)..
then i need the o/p as available seats ..means if any body selects the program...then the maxseats should be decremented by 1...o/p should be the remaing seats..
![]() |
0 |
![]() |
Eh?
To get the number of seats for a program:
SELECT maxseats
FROM programs
WHERE program_id = @ProgramIdAnd you might be needing a couple of UPDATE queries for the other logic:
UPDATE reserved_table
SET status = 'Approved'
WHERE program_id = @ProgramIdUPDATE programs
SET maxseats = maxseats - 1
WHERE program_id = @ProgramId
Coolest Bananas
![]() |
0 |
![]() |