Click here to Skip to main content
15,887,376 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is the code but why is there an error of Unknown column l.zipcode in field list when i declare location at the beginning?

select l.zipcode,sum(dum.tab) from location l,
(select count( Pickup_location) as tab from booking b,location l where b.pickup_location = l.Zip_Code
union select count(destination) as tab from booking_destinations bd inner join location l on bd.destination = l.Zip_Code where bd.sequence in(1,2,3)
union select count(destination) as tab from booking_destinations bd,location l where bd.destination = l.Zip_Code and sequence = 4
) as dum where l.zipcode = 18953;

What I have tried:

i have tried removing location at the beginning of sql statement
Posted
Updated 25-Mar-16 4:26am

1 solution

Asking the obvious but does the location table have a column called zipcode? Elsewhere in the sql you use zip_code.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900