Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/11/2012, 00:07
GeriReshef
 
Fecha de Ingreso: julio-2012
Ubicación: Israel
Mensajes: 360
Antigüedad: 12 años, 7 meses
Puntos: 40
Respuesta: Consulta sql tabla categorias y tabla subcategorias

Supongo que las categorias tienen ID_Categoria y Nombre;
y las subcategorias tienen ID_SubCategoria, ID_Categoria y Nombre:
Código SQL:
Ver original
  1. SELECT  0 Tipo,
  2.     ID_Categoria,
  3.     0 ID_SubCategoria,
  4.     Nombre
  5. FROM    Categorias
  6. UNION ALL
  7. SELECT  1 Tipo,
  8.     ID_Categoria,
  9.     ID_SubCategoria,
  10.     Nombre
  11. FROM    SubCategorias
  12. ORDER BY ID_Categoria,
  13.     Tipo,
  14.     ID_SubCategoria;
__________________
El Castellano no es mi lengua materna: discúlpenme por los errores gramaticales.
Mi blog