PDA

View Full Version : JOIN'ers..


MattR
Sat 28th Oct '00, 11:43pm
P.S.

To all those using JOINs, there is an easier way of writing them:

SELECT bob.someid, bob.title, joe.name
FROM bob, joe
WHERE bob.bobid = joe.bobid

can be rewritten as:


SELECT b.someid, b.title, j.name
FROM bob b, joe j
WHERE b.bobid = j.bobid


Easier on the eyes, and to type as well. :)

Krucifyx
Sun 29th Oct '00, 1:15am
It all depends on the person. Same may prefer bob to b. There really is no difference in the two, just a tad change in the syntax.

eva2000
Sun 29th Oct '00, 1:40am
hey matt .. hey tommy :D

it all looked the same to an untrained eye :(

MattR
Sun 29th Oct '00, 2:21am
Originally posted by Krucifyx
It all depends on the person. Same may prefer bob to b. There really is no difference in the two, just a tad change in the syntax.

Since I am lazy, I prefer writing "b.bobid" rather than "bob.bobid". I noticed this after looking at the joins that some of the optimizing scripts use, it would've meant less typing for the author to use "b." rather than "bob.". :)

I prefer the former, of course! :D

Freddie Bingham
Sun 29th Oct '00, 12:30pm
Considering it is only 1 SQL statement, I don't think I lost any years in typing the full version out instead of the renaming version..I do know the syntax but don't really like to do it unless the fields are really, really long.