Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/09/2014, 15:28
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 9 meses
Puntos: 774
Respuesta: mostrar varias columnas de distintas tablas

sencillo:

Código SQL:
Ver original
  1. SELECT * FROM(
  2. SELECT  T1.intGeneralCargoUniversalId AS Universal_ID,
  3.         T1.intGCInventoryItemId AS Item_Inventario,
  4.         T1.intGCInvItemQuantity AS Cantidad,
  5.         T1.decGCInvItemWeight AS Peso,
  6.         T1.dtmGCInvItemReceptionDate AS Fecha_Captura,
  7.         T1.strGCInvItemCreatedBy AS Capturado_por
  8. FROM    tblclsGCInventoryItem T1
  9. WHERE  T1.intGeneralCargoUniversalId IN (SELECT intGeneralCargoUniversalId
  10. FROM    dbCalathus.dbo.tblclsGeneralCargoInventory  AS T2
  11. WHERE   T2.blnGCInventoryActive =1) AND T1.intGCFiscalStatusId=1 ORDER BY  T1.intGeneralCargoUniversalId
  12. ) AS tabla1
  13. LEFT JOIN
  14. (
  15. SELECT strProductName
  16. FROM  dbCalathus.dbo.tblclsProduct T3
  17. WHERE T3.intProductId IN (SELECT intProductId
  18.  FROM dbCalathus.dbo.tblclsGeneralCargoInventory  AS T2
  19. WHERE  T2.blnGCInventoryActive =1)
  20. ) AS tabla2 ON (tabla1.id=tabla2.id)

Magia ;)
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me