Ver Mensaje Individual
  #4  
Antiguo 07-05-2004
Avatar de jachguate
jachguate jachguate is offline
Miembro
 
Registrado: may 2003
Ubicación: Guatemala
Posts: 6.254
Reputación: 28
jachguate Va por buen camino
Cool

Cita:
Empezado por Gydba
pensé que en el primer SELECT de ejemplo que puse quedaba claro
Pues a mi me quedo la duda... y me parecia que mas que todo, lo que querias era eso

Cita:
Empezado por Gydba
¿Cuál es la definición de un LEFT JOIN?
esto:

Cita:
Empezado por SQL Reference
An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no rows from the other satisfy the join condition.

* To write a query that performs an outer join of tables A and B and returns all rows from A (a left outer join), use the LEFT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+) to all columns of B in the join condition in the WHERE clause. For all rows in A that have no matching rows in B, Oracle returns null for any select list expressions containing columns of B.
* To write a query that performs an outer join of tables A and B and returns all rows from B (a right outer join), use the RIGHT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+) to all columns of A in the join condition in the WHERE clause. For all rows in B that have no matching rows in A, Oracle returns null for any select list expressions containing columns of A.
* To write a query that performs an outer join and returns all rows from A and B, extended with nulls if they do not satisfy the join condition (a full outer join), use the FULL [OUTER] JOIN syntax in the FROM clause.
El problema aqui, es cual es la join condition. Se sobreentiende que será una expresión que relacione al menos un campo de cada tabla... porque hacer algo como:
Código SQL [-]
Select a.campo1, b.campo2
  from a left outer join b on b.Campo1 = 'CualquierCosa'
no parece un outer join... parece simplemente un encuentro cartesiano de las tablas, que igual se puede conseguir sin un outer join

Código SQL [-]
Select a.campo1, b.campo2
 from a, b
 where b.campo1 = 'cualquiercosa'

Pues en realidad no hay nada que "relacione" las tablas... o estoy equivocado??

Hasta luego.

__________________
Juan Antonio Castillo Hernández (jachguate)
Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate
Responder Con Cita