On 9/20/06, Rick Faircloth <[EMAIL PROTECTED]> wrote: .... > <cfquery name="your_query"> > SELECT * > FROM dates_table, > events_table > WHERE dates_table.EventID = events_table.EventID > </cfquery> .... > But, my question concerning it being "bad code" was, really, how > much slower for probably a small amount of data would this > code be?
I don't think speed is the main concern folks are talking about with the example. (although I've never had any problems with that syntax, using various DBs... it's supported, if not a standard(?)). The main thing I like about joins is the LEFT JOIN. It's awesome. Given the example above, if there were no dates in the date table, you wouldn't see the event. So if you're code is expecting to see all the events, including ones that don't have dates, you'd need a left join. It was pointed out earlier, but has been overshadowed by the talk of ANSI stuff. I happen to think it's the most important difference between the two "styles". One is really a join, the other is more of a "where". If you are adding stuff up, for instance, those LEFT JOINs are key to getting ALL the info you want from the LEFT table, vs. just the matching records. Anyway... > (And I was wondering, too, why there would even be a separate > "dates" table in a relational database...if this is a calendar, I would > have put the dates of an event in the event table itself...???) Depends on how "normalized" you want your data. You may have repeating events, for instance, or events with specialized requirements for each date. It becomes a real mess if you don't split it up a little. If it's a really simple event system, sure, the dates could be in the same table as the event, but from my experience, there is NEVER a simple event system. They always want more. Thus, I normalize well before it's needed, much of the time. Generally I haven't been burned by that rule of thumb... 'cept you really need to know your SQL (especially joins!). The DB is WAY faster at putting stuff together than pulling the bits and pieces out and putting them together via CF. Eh... interesting thread... I never knew that the WHERE syntax of "joining" tables was non-standard. Something new every day, right-o! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253683 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

