SQL COUNT() statement not working -


i trying return total number of reserved seats in flightbooking table using flightid number.

select count(flight.flightid) reservedseats flightbooking status=r 

i error saying

error: missing from-clause entry table "flight" line 1: select count(flight.flightid) reservedseats flightbo...

what doing wrong?

try:

select count(flight.flightid) reservedseats    flightbooking flight  status='r' 

you referring flight.flightid there isn't table name or alias flight. engine doesn't know should retrieve flightid from. missing quotes around char value r.

in comment "i know nothing sql". appriciated if research before come here asking help.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -