SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: simple sql problem
-
Mar 26, 2002, 22:25 #1
- 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
-
Mar 27, 2002, 07:19 #2
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 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
Learn how to be ready for The Forums' Move to Discourse
-
Mar 27, 2002, 10:14 #3
- 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';
-
Mar 27, 2002, 10:18 #4
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 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';
Dave Maxwell - Manage Your Site Team Leader
My favorite YouTube Video! | Star Wars, Dr Suess Style
Learn how to be ready for The Forums' Move to Discourse
-
Mar 27, 2002, 10:23 #5
- 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
-
Mar 27, 2002, 22:47 #6
- 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
-
Mar 28, 2002, 07:11 #7
- Join Date
- Nov 1999
- Location
- Mechanicsburg, PA
- Posts
- 7,294
- Mentioned
- 123 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
Learn how to be ready for The Forums' Move to Discourse
-
Mar 28, 2002, 14:17 #8
- Join Date
- Sep 2001
- Location
- St. Louis, MO
- Posts
- 212
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bookmarks