SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    St. Louis, MO
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple sql problem

    Hi,

    I have a small db which stores information about homes that a real estate broker has listed at any given time.

    I currently have it set up when the visitor to the site hits 'listings', all the homes available will come up as text links which say which area they are in.

    So for instance if there are 3 listings in St. Louis county, there will be 3 text links....

    St.Louis county
    St.Louis county
    St.Louis county

    Instead of that I'm opting for a single text link to every municipality which will display all of the listings at once.

    I'm using a very simple query to do so, but anytime a period is used, it yields nothing...

    select * from homes
    where homes.location = 'st.louis';

    If I do this...

    select * from homes
    where homes.location = 'chesterfield';

    it works fine.

    This has got to be simple, but I'm not finding anything on it.

    Thanks for any help,
    Rob

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,200
    Mentioned
    105 Post(s)
    Tagged
    1 Thread(s)
    A couple questions...

    Is the field case sensitive? Do you have any extraneous spaces or non-dislayable characters at the end of the line? Is County part of the name, or just something added in your display?
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm thinking a DISTINCT select would work...
    Code:
    SELECT DISTINCT * FROM homes 
    WHERE homes.location = 'st.louis';

  4. #4
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,200
    Mentioned
    105 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by redemption
    i'm thinking a DISTINCT select would work...
    Code:
    SELECT DISTINCT * FROM homes 
    WHERE homes.location = 'st.louis';
    Not if it's not returning anything...
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style

  5. #5
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whoops i missed that part...

    i'm thinking since you're already SELECTing FROM homes you don't need the home.colname anymore...
    just
    SELECT DISTINCT * FROM homes WHERE location = 'st.louis';

    of course i could be totally wrong

    apologies for the mistake

  6. #6
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    St. Louis, MO
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys,

    Dave's questions...

    Is the field case sensitive?.. No

    Do you have any extraneous spaces or non-dislayable characters at the end of the line?.. No

    Is County part of the name, or just something added in your display?..It is part of the name. I use it to distict from St.Louis City.

    I also tried the SELECT DISTINCT and stripped 'location' from homes to no avail. I entered in different dummy info in the db and troubleshot for a while and have come to the conclusion that its the period after "St" that it doesn't like. I don't know why that is.

    I can continue to develop the rest of the site in the meantime and use other towns for test data.

    Thanks for the input,
    Rob

  7. #7
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,200
    Mentioned
    105 Post(s)
    Tagged
    1 Thread(s)
    If it's part of the name, then it's not going to work like this:

    select * from homes
    where homes.location = 'st.louis';

    You need to use:

    select * from homes
    where homes.location = 'st.louis county';
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style

  8. #8
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    St. Louis, MO
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry....I am searching for it that way, I was just emphasizing the period in there which seems to trip it up. I should of said that earlier


Bookmarks

Posting Permissions

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