1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| SELECT distinct
ttrecepcionista.nombre as "receptionnaire",
ttOTCab.[NumOT] as "numeroor",
ttOTCab.Apellido1 as "nom_client",
ttotcab.fechaaperturaot as "date_creation",
ttOTCab.Matric as "immat",
ttOTCab.Vehiculo as "vehiculo" ,
ttotcab.chasis as "vin",
ttotcab.desversion as "modele",
ttotcab.km as "km",
1111111 as test,
[tgMarca].[Descrip] as "marque_vehicule" ,
[ttSeccion].[Descrip] as "seccionintervencion"
FROM
ttoTCab
LEFT JOIN TGCLIENTE tgclientefac on tgclientefac.Codigo=ttOTCab.ClienteFac
LEFT JOIN TGCLIENTE tgclientecond on tgclientecond.Codigo=ttOTCab.ClienteCond
LEFT JOIN TGCLIENTE tgclienteprop on tgclienteprop.Codigo=ttOTCab.ClienteProp
inner join tgempresa on ttotcab.emp = tgempresa.emp
inner join tgtaller on ttotcab.emp = tgtaller.emp and ttotcab.taller = tgtaller.taller
inner join tgorganis on tgorganis.Organis =tgTaller.Organis and tgtaller.emp=tgorganis.Emp
INNER JOIN ttVeh on ttveh.Numinterno =ttoTCab.Vehiculo
INNER JOIN ttOTIntervencion ON ttOTCab.Emp = ttOTIntervencion.Emp AND ttOTCab.NumInterno = ttOTIntervencion.Numinterno
INNER JOIN ttOTLinea ON ttOTIntervencion.Emp = ttOTLinea.Emp AND ttOTIntervencion.Numinterno = ttOTLinea.NumIntOT AND ttOTIntervencion.Intervencion = ttOTLinea.NumIntIntervencion
INNER JOIN ttSeccion ON ttOTCab.Seccion = ttSeccion.Seccion
INNER JOIN ttSeccion seccion ON ttOTIntervencion.Seccion = seccion.Seccion
LEFT OUTER JOIN TTrecepcionista ON ttOtCab.emp = TTrecepcionista.emp and ttOtCab.taller = TTrecepcionista.taller and ttOtCab.recepcionista = TTrecepcionista.recepcionista
LEFT OUTER JOIN TTrecepcionista TTrecepcionista2 ON ttOtCab.emp = TTrecepcionista2.emp and ttOtCab.taller = TTrecepcionista2.taller and ttOtCab.secretaria = TTrecepcionista2.recepcionista
LEFT OUTER JOIN Tgmarca ON ttOtCab.marca = tgmarca.marca
LEFT OUTER JOIN tgMarca MarcaLinea ON ttOTLinea.Marca = MarcaLinea.Marca
LEFT OUTER JOIN tacategoriapieza ON ttotlinea.marca = tacategoriapieza.marca and ttotlinea.codigocategoria = tacategoriapieza.codigo
LEFT OUTER JOIN ttotstatus ON ttOTCab.statusencurso = ttotstatus.Codigo
WHERE |
Partager