--select * from ast_bilhetes where calldate::date = now()::date and calldate > '2012-03-27 14:30:00' select * from pbx_bilhetes where calldate::date = now()::date and calldate > '2012-03-27 14:30:00' select * from ast_bilhetes where id_bilhetes = 1019944 select b.* from pbx_bilhetes a, pbx_eventos_dacs b where calldate::date = now()::date and calldate > '2012-03-27 14:30:00' and b.uid2 = a.uniqueid and fila = 'simples' select b.* from pbx_bilhetes a, pbx_eventos_dacs b where calldate::date = now()::date and calldate > '2012-03-27 14:30:00' and b.uid2 = a.uniqueid and fila = 'transbordo' and b.uid2 <> coalesce( (select uid2 from pbx_eventos_dacs where uid2 = b.uid2 and evento = 'TRANSBORDANDO'), '-1') select uid2 from pbx_eventos_dacs where uid2 = '1332880821.3357' and evento = 'TRANSBORDANDO' select * from pbx_eventos_dacs where uid2 = '1332880992.3362' select b.* from pbx_bilhetes a, pbx_eventos_dacs b where calldate::date = now()::date and calldate > '2012-03-27 14:30:00' and b.uid2 = a.uniqueid and fila = 'transbordo'