SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: Seperate Out Repeats on SQL Join
-
Jul 9, 2007, 10:56 #1
- Join Date
- Jan 2007
- Location
- Colorado Springs, CO
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Seperate Out Repeats on SQL Join
Ok so I have my join working and am attempting to filter out any duplicates of a single column. I don't even know where to start for this. Basically on the join I want to check for any duplicates of the 'PropID' column and only post one copy of the PropID onto my webpage.
What's the best method to accomplish this?
-
Jul 9, 2007, 10:58 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
-
Jul 9, 2007, 11:15 #3
- Join Date
- Jan 2007
- Location
- Colorado Springs, CO
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:SELECT a.PropID, a.PropName, a.LargeDogs, b.Size FROM properties AS a INNER JOIN floorplans AS b ON b.PropID = a.PropID WHERE a.Active = '1' AND b.Size LIKE '2BD%' ORDER BY a.PropID LIMIT 30
-
Jul 9, 2007, 11:22 #4
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
gee, a different thread, but i'm sure i've seen that query before
what would you like to show along with each unique PropID?
obvioulsy if each property has multiple floorplans with sizes like '2BD%', then which size would you like to show?
-
Jul 9, 2007, 11:31 #5
- Join Date
- Jan 2007
- Location
- Colorado Springs, CO
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yep just noticed it was you that replied. Other forum was the database one though and figured was best to move this over to the PHP forum.
Basically just need the PropID to be unique.
-
Jul 9, 2007, 11:39 #6
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
so you don't need any sizes at all in the query results?
-
Jul 9, 2007, 11:42 #7
- Join Date
- Jan 2007
- Location
- Colorado Springs, CO
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Nope just need to know they do exist. Basically there will be a page that has some checkboxes to select options that will be searched for. This query was hopefully going to accomplish that.
-
Jul 9, 2007, 12:12 #8
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
okay, do this:
Code:SELECT DISTINCT a.PropID, a.PropName, a.LargeDogs FROM properties AS a INNER JOIN floorplans AS b ON b.PropID = a.PropID WHERE a.Active = '1' AND b.Size LIKE '2BD%' ORDER BY a.PropID LIMIT 30
Bookmarks