Advertisement
slovacus

consulta de kotear

Mar 23rd, 2012
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.59 KB | None | 0 0
  1. SELECT * FROM KO_UBIGEO
  2.  
  3.  -- @UBI= 15 se refiere a la localidad de lima
  4.  DECLARE @UBI VARCHAR(3)=15
  5.  
  6.  SELECT arb.ID_CATEGORIA,arb.NOM_CATEGORIA Nombre,COUNT(arb.ID_CATEGORIA) n,
  7.  'http://kotear.pe/busqueda/?q&categs='+CONVERT(VARCHAR(6),arb.ID_CATEGORIA)+'&ub='+@UBI+'&ubic[]='+@UBI url
  8.  FROM KO_CATEGORIA_ARBOL arb
  9. INNER JOIN KO_AVISO_CATEGORIA acat ON acat.ID_CATEGORIA=arb.ID_CATEGORIA
  10. AND arb.ADULTO=0
  11. INNER JOIN KO_AVISO avi ON avi.ID_AVISO=acat.ID_AVISO AND avi.EST=1
  12. AND avi.FLAG_MODERACION=0 AND FLAG_MODERACION_ADMIN=0
  13.  AND FEC_FIN>GETDATE()
  14. GROUP BY arb.ID_CATEGORIA,arb.NOM_CATEGORIA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement