PDA

View Full Version : help with query



daraptor
12-13-2006, 02:37 PM
hey guyz...am a newbie to sql....
i got this table in MS access which has got all the airport codes.........
the name of the table is Airport_codes...
the column names in the table are.....Airport_code, Airport_name, State, Country......so my problem is what would be the query to get any airport code.....for example
when i type cmh in the search box it should bring up port columbus intl airport .....
like this i should be able to bring up any airport code jss by typin the code in the search box....i hope u got my point....i know this is a dumb question...but am a newbie...am quite confused...hope someone will help me out with this.....thanx guyz......

Brandoe85
12-13-2006, 03:06 PM
From the sounds of it you'll need to use the where clause:
select * from airport_codes where airport_code = your value

ref:
http://www.databasedev.co.uk/using-where-clause.html

Good luck;

daraptor
12-13-2006, 03:52 PM
brandoe ....whats the my value....is it the name of the form or what.....plz help me man.....

Brandoe85
12-13-2006, 03:54 PM
It's the airport_code ( or whatever you type) in your example it would be 'cmh':
select * from airport_codes where airport_code = 'cmh'

daraptor
12-13-2006, 04:19 PM
hey brandoe thanx man...got it....hey man....one more question....i was able to bring up the airport code which i want..but is there any way i can bring up even if i type in the country.....like
if i type USA..it should bring up all the airport codes in USA.....thanx for the help man...appreciate it.....

Brandoe85
12-13-2006, 04:34 PM
You're welcome.

Switch the field from airport_code to country:
select * from airport_codes where country = 'USA'

guelphdad
12-13-2006, 06:20 PM
since you are using ACCESS this does not belong in the MySQL forum, I'll move it into the general database discussion forum.