| Brian Chandler |
Sep 24 2006, 04:53 AM
Post
#1
|
|
Jocular coder ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,143 Joined: 31-August 06 Member No.: 43 |
Any DB experts here?
I can't understand almost all of the MySQL manual's explanation relating to *join*. So I'm looking either for an answer to my problem, or (preferably) a reference to a good technically clear description. (What I mean by technically clear is that it doesn't matter how complicated something is, if you define terms, and then use them consistently. In the MySQL join stuff, the word "natural" for example is used to mean, roughly, "Uh, where was I? Well, you know...") I have a table of puzzles: many columns, each a property of the puzzle identified by the code that is the primary key column. Very straightforward and simple. I also have a many-many table, relating puzzles to topics. One puzzle may have more than one, and obviously each topic pertains to many puzzles. I want to extract the set of puzzles having a topic or topics. For one (e.g. 'fish'), this is simple: SELECT * FROM puzzle, topic WHERE puzzle.pcode = topic.pcode AND topic.tcode = 'fish'; (pcode is the puzzle identifier, tcode is the topic identifier) But suppose I want to find puzzles on 'fish' or 'beans'? I need only the distinct rows from the puzzle table, but I can't understand the scope of the DISTINCT keyword - unless I can restrict it to apply to the puzzle table only, it will obviously claim that "puzzle 1 relating to fish" and "puzzle 1 relating to beans" are distinct. Grateful for any assistance. -------------------- Brian Chandler
Nothing in this post constitutes "commercial solicitation". PayPal does not solicit residents of Japan. Contents may settle in transit. "Legal mind" may or may not be brain-damaged. |
![]() ![]() |
| Sparkyg |
Sep 30 2006, 04:06 PM
Post
#2
|
|
Member ![]() ![]() ![]() Group: Members Posts: 46 Joined: 29-September 06 From: Suffolk UK Member No.: 270 |
Hi Brian
All looks and sounds good to me, I was half expecting a table with a hundred or so fields lol. As long as you are passing by reference then there should be no problems. Catch ya later Sparky -------------------- If I have helped in any way then I would be grateful if you could Donate a photo to ' Free Photos for Websites ' millions of webmasters need your help :)
web design ipswich web design essex |
Brian Chandler Mysql joins Sep 24 2006, 04:53 AM
Sparkyg Hi There
The scope of distinct is the unique rows... Sep 29 2006, 05:24 AM
Brian Chandler
Hi There
The scope of distinct is the unique row... Sep 29 2006, 11:12 PM
Sparkyg Hi There
If you have to write these selects all t... Sep 30 2006, 02:27 AM
Brian Chandler
Hi There
If you have to write these selects all ... Sep 30 2006, 12:42 PM![]() ![]() |
|
Lo-Fi Version | Time is now: 23rd May 2013 - 11:33 PM |