Blitz Posted January 4, 2006 Report Share Posted January 4, 2006 Ir divas tabulas: Vienaa tabulaa ir proxy logu statistika: ID Datums Laiks IP Web Url Otraa tabulaa ir sleepto webu saraksts ID Web Ideja tada ka jadabuun to cik lietotajs reizu ir apmekleejis webu, ignorejot tos ierakstus kuri arodami sleepto webu listee. Lidz sim izmantoju vienkarsi SELECT IP, COUNT(ISN) FROM PROXY_LOG GROUP BY IP ORDER by COUNT(ISN) desc Bet tas parada skaitu nenemot veeraa sleepto webu listi. Varbut ir kada iespeja kveriju uzrakstiit kaut kaa shaadi. SELECT IP, COUNT(ISN) FROM PROXY_LOG WHERE (konkretais ieraksts nav vienads ar nevienu no sleepto lista ierakstiem) GROUP BY IP ORDER by COUNT(ISN) desc Es ceru ka ideju saprataat. Ja tas vispar ir iespejams tad ludzu pasviediet kadu ideju. P.S. Tiek izmantota FireBird, bet tas laikam nav butiski. Link to comment Share on other sites More sharing options...
bubu Posted January 4, 2006 Report Share Posted January 4, 2006 (edited) SELECT ip, COUNT(isn) FROM proxy_log WHERE web NOT IN (SELECT web FROM sleeptie_web) GROUP BY ip ORDER BY COUNT(isn) DESC Edited January 4, 2006 by bubu Link to comment Share on other sites More sharing options...
Blitz Posted January 4, 2006 Author Report Share Posted January 4, 2006 wow, baigi labi... liels paldies! Link to comment Share on other sites More sharing options...
GedroX Posted January 6, 2006 Report Share Posted January 6, 2006 Vienā selektā arī var: SELECT p.ip, COUNT(p.isn) FROM proxy_log p LEFT JOIN sleeptie_web s ON s.web = p.web WHERE ISNULL(s.web) GROUP BY p.ip ORDER BY COUNT(p.isn) DESC :P Link to comment Share on other sites More sharing options...
v3rb0 Posted January 6, 2006 Report Share Posted January 6, 2006 (edited) GedroX: ka tik web lauks viņam nav char? ja tā tad man liekas ka left joins ar char var būt pat lēnāks nekā not in( select ..) Edited January 6, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
Recommended Posts