2011/04/26 17:55 +0300, Andre Polykanine
Aha. So, I should write
SELECT `Blogs`.* INNER JOIN `Users` ON `Users`.`Id`=`Blogs`.`UserId`
instead of my original WHERE clause?
Thanks!
I think so.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/my
://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
Original message
From: Halбsz Sбndor
To: Andre Polykanine
Date created: , 7:00:03 AM
Subject: LEFT JOIN and WHERE: identical or not and what is better?, etc.
>>>> 2011/04/25 17:42
I would go with join rather than where condition.
2011/4/26 Halász Sándor
> 2011/04/25 17:42 +0300, Andre Polykanine
> Here is the first one.
> We have two queries:
> SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON
> `Blogs`.`UserId`=`Users`.`Id`;
> and the following o
2011/04/25 17:42 +0300, Andre Polykanine
Here is the first one.
We have two queries:
SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON
`Blogs`.`UserId`=`Users`.`Id`;
and the following one:
SELECT `Blogs`.* FROM `Blogs`, `Users` WHERE
`Blogs`.`UserId`
Hi Andre, everybody!
Andre Polykanine wrote:
> Hello everyone,
> Sorry for my beginner question. Actually I have been using MySql for a
> long time but I just start using some advanced things (earlier I
> accomplished those tasks with PHP), so I will be asking stupid
> questions, pl
The only difference once MySQL parses these two queries is the first one is
a LEFT JOIN, which will produce all records from the blogs table even if
there is no matching record in the users table. The second query produces an
INNER JOIN which means only rows with matching records in both tables wil
I can be wrong about that, but I think the difference between them should be
irrelevant so it makes me think about a paranoiac thought.
For me, the only difference is: Chose the one you feel better to understand
your code.
Am I wrong or not?
--
João Cândido de Souza Neto
"Andre Polykanine"
'where' is a filter. You're limiting records based on a criterion.
'on' is used for joining.
On Mon, Apr 25, 2011 at 10:42 AM, Andre Polykanine wrote:
> Hello everyone,
> Sorry for my beginner question. Actually I have been using MySql for a
> long  time  but  I  just  start  using some
Hello everyone,
Sorry for my beginner question. Actually I have been using MySql for a
long time but I just start using some advanced things (earlier I
accomplished those tasks with PHP), so I will be asking stupid
questions, please bear with me.
Here is the first one.
We have two que