Takanobu Kawabe schrieb:

> Hello, my  name  is  Takanobu  Kawabe.
こんいちわ孝信さん:)

> I  have some questions  about  left join  SQL statement.
> 
> I want to join some  tables, and  using  left  join  statement .
> 
> the  system is the following.  I use two machines.
> 
> I  created  the  same  databases  and  tables  on  both machines.
> 
> OS : Debian Linux the newest  stable 3.1
> Server : Apache 2.0
> MySQL : 5.0.20
> PHP : 5.1.4
> 
> OS : WindowsXP
> Server : Apache2.0
> MySQL : 5.0.19
> PHP : 5.1.2
> 
> 
> 
> And  I  considered  the following SQL statement to select  some columns from 
> some tables  using  left  join.
> 
> 
> ----------------------------------------------------------------------------
> SELECT
> `MST`.`no`,
> `MST`.`denhyono`,
> `GUS`.`TANI` AS `GUS`,
> `SUIDO`.`TANI` AS `SUIDO`,
> `DENKI`.`TANI` AS `DENKI`,
> `SYOKUIN1`.`SYOKUINNAME` AS `SYOKUIN1`,
> `SYOKUIN2`.`SYOKUINNAME` AS `SYOKUIN2`,
> `TANTOSYA`.`TANTOSYANAME` AS `TANTOSYA`
> FROM
> `MST`
> Left Join `TANIMST` AS `GUS` ON `MST`.`GUSno` = `GUS`.`no`
> Left Join `TANIMST` AS `SUIDO` ON `MST`.`SUIDOno` = `SUIDO`.`no`
> Left Join `TANIMST` AS `DENKI` ON `MST`.`DENKIno` = `DENKI`.`no`
> Left Join `SYOKUINMST` AS `SYOKUIN1` ON `MST`.`SYOKUINno1` = `SYOKUIN1`.`no`
> Left Join `SYOKUINMST` AS `SYOKUIN2` ON `MST`.`SYOKUINno2` = `SYOKUIN2`.`no`
> Left Join `SYOKUINMST` AS `TANTOSYA` ON `MST`.`TANTOSYAno` = 
> `TANTOSYA`.`no`;
> 
> ---------------------------------------------------------------------------------
> I tried  this statement  without error.
> 
> But Ihave some questions.
> 
> 
> 1.How  many  left join  keywords   can  I   use   in  one SQL statement  if 
> there
> are   5000 datas in  one  table?
As much as you like. there are no limitations.

> 2. when  some customers  use  this  query,  can  they  read  this  query 
> exactly?
Depends on the MySQL knowledge of your customer.
But when they are good in SQL they shouldn't have any problem with it.

> 3. Will  the  above  query  speed  become slowly  if   there  are   5000 
> datas in  one  table?
Set indizes. This way your queries will speed up.

> Will the processing efficiency  improve  if  I  use   multiple SQL 
> statement?

Always depends on the process.
There are processes where multiple SQL queries come in handy.


> 4.Is  there  any  other  effective  SQL  statement   I  can   get  better 
> processing efficiency?

The beast way would be to start reading the optimization of MySQL:
http://dev.mysql.com/doc/refman/5.0/en/optimization.html

Here you get a lot of helpful omtimizations for your queries.

それじゃ。

Barry
-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to