Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- pty.id,
- i.id AS aviso_id,
- dpa.contrato AS cod_contrato,
- i.titulo_aviso AS distrito_desc_abr,
- i.Texto_Aviso AS descrip_impreso,
- CASE (IF(pty.uid > 0, 21, pty.parent))
- WHEN 3 THEN IF(pty.TYPE = 1, '101', '109')
- WHEN 5 THEN IF(pty.TYPE = 1, '102', '110')
- WHEN 14 THEN IF(pty.TYPE = 1, '1031', '1111')
- WHEN 4 THEN IF(pty.TYPE = 1, '103', '111')
- WHEN 1 THEN IF(pty.TYPE = 1, '104', '112')
- WHEN 21 THEN '116'
- WHEN 6 THEN '113'
- END AS seccion_diario,
- IF(t.tipo_pago = 2,
- t.token,
- t.id + 87000000) AS token_pago,
- CASE (t.tipo_pago)
- WHEN 0 THEN 'Visa'
- WHEN 1 THEN 'Mastercard'
- WHEN 2 THEN 'PagoEfectivo'
- END AS tipo_pago,
- dpa.precio,
- pty.published,
- pty.name,
- pty.extra32 AS fecha_creacion_aviso,
- t.fecha_modificacion AS fecha_pago,
- i.fecha_publicacion,
- u.name,
- u.apepat,
- u.email,
- t.origen,
- t.tipo_pago AS medio_de_pago,
- t.id AS transac_id,
- pty.image1 AS nombre_fotovineta,
- pty.bedrooms AS num_dormitorios,
- pty.years AS antiguedad,
- pty.area AS area_total,
- pty.covered_area AS area_construida,
- pty.TYPE AS tipo_transac_cod,
- pty.parent AS tipo_inmueble_cod,
- pty.uid,
- lo.Cod_ciudad AS distrito_cod,
- lo.Cod_Departamento AS departamento_cod,
- '0' AS tiene_fotovineta,
- p.tipo_doc,
- p.nro_doc,
- p.razon_social,
- p.direccion,
- p.tipo_cliente,
- p.estado,
- e.ente_code,
- e.Cod_Direccion,
- pty.extra1,
- pty.srb_deportiva,
- pty.srb_vista,
- pty.extra16,
- pty.price AS precio_inmueble,
- dpa.tb_paquetes_agente_id AS paquete_cod,
- 0 AS aviso_bonificado
- FROM
- tb_products_impreso i
- INNER JOIN
- tb_detalle_paquete_agente dpa ON i.tb_detalle_paquete_id = dpa.id
- INNER JOIN
- tb_properties_products pty ON pty.id = i.tb_properties_products_id
- INNER JOIN
- tb_properties_locality lo ON pty.lid = lo.id
- INNER JOIN
- tb_transaccion t ON t.tb_detalle_paquete_id = dpa.id
- LEFT JOIN
- tb_perfil_pago p ON p.id = t.tb_perfil_pago_id
- LEFT JOIN
- tb_users u ON u.id = p.tb_users_id
- LEFT JOIN
- tb_perfil_pago_ente e ON p.ente_id = e.ente_code
- WHERE
- i.fecha_publicacion = '2012-08-26'
- AND t.procesado = 1 AND
- i.estado = 0 AND t.origen = 3
- AND i.paq_agente = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement