From: Daevid Vincent Date: May 19 2006 9:52pm Subject: RE: Need a query to show distinct IP dotted quad components [SOLVED] List-Archive: http://lists.mysql.com/mysql/198134 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I may have just solved my own problem: SELECT DISTINCT(SUBSTRING_INDEX(INET_NTOA(IP_Addr), '.', 3)) as niceip FROM IPTable HAVING niceip LIKE '192.168.15%'; http://dev.mysql.com/doc/refman/5.0/en/string-functions.html > -----Original Message----- > From: Daevid Vincent [mailto:daevid@stripped] > Sent: Friday, May 19, 2006 2:46 PM > To: mysql@stripped > Subject: Need a query to show distinct IP dotted quad components > > I have a table of many IP addresses. I'm doing some > PHP/JS/AJAX to populate > a select box based upon what someone types in a search field. > That works > great, except that a user can spend a lot of time guessing as to what > possible IPs exist. > > What I'd like to do now is one of those "google" suggestions > thingys where > as you type an IP it suggests the DISTINCT possible next numbers in a > drop-down