Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: help with query

  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts

    help with query

    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......

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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;

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    brandoe ....whats the my value....is it the name of the form or what.....plz help me man.....

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    It's the airport_code ( or whatever you type) in your example it would be 'cmh':
    select * from airport_codes where airport_code = 'cmh'

  • #5
    New Coder
    Join Date
    Dec 2006
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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.....

  • #6
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You're welcome.

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

  • #7
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    since you are using ACCESS this does not belong in the MySQL forum, I'll move it into the general database discussion forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •