Advertisement
slovacus

script de raul

Mar 23rd, 2012
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.67 KB | None | 0 0
  1. DECLARE @UBI VARCHAR(3)=15
  2.  
  3.  SELECT arb.ID_CATEGORIA,arb.NOM_CATEGORIA Nombre,COUNT(avi.ID_AVISO) n,
  4.  'http://kotear.pe/busqueda/?q&categs='+CONVERT(VARCHAR(6),arb.ID_CATEGORIA)+'&ub='+@UBI+'&ubic[]='+@UBI url
  5. FROM KO_CATEGORIA_ARBOL arb
  6. INNER JOIN KO_AVISO_CATEGORIA acat ON acat.ID_CATEGORIA=arb.ID_CATEGORIA
  7. AND arb.ADULTO=0
  8. INNER JOIN KO_AVISO avi ON avi.ID_AVISO=acat.ID_AVISO AND avi.EST=1
  9. AND avi.FLAG_MODERACION=0 AND FLAG_MODERACION_ADMIN=0
  10. AND FEC_FIN>GETDATE()
  11. AND avi.ID_UBIGEO = 15
  12. AND arb.ID_CATEGORIA IN (231,221,237,
  13.  243,235,208,228,
  14.  234,226,233,232,
  15.  244,230,1909,
  16.  229,1621,219,247,1381,
  17.  241,217,3489
  18.  )
  19. GROUP BY arb.ID_CATEGORIA,arb.NOM_CATEGORIA;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement