Hello.
Something like this: SELECT INET_NTOA((INET_ATON(odip)>>8)<<8) AS mask , COUNT(odip) FROM a GROUP BY mask; You can merge results from both tables using UNION. See more about INET_xxx functions at: http://dev.mysql.com/doc/mysql/en/miscellaneous-functions.html rmck <[EMAIL PROTECTED]> wrote: > In each database I have a table with one column I want to compare and then > count. So db1.a.odip and db2.aa.newip are the databases, table and coulumns. > > The data in each column is Ip's, so my result would be a list and count for > each by subnet. So the result would be like: > > db1.a.odip count > ------------ ------- > 10.10.10. 30 > 192.168.5. 10 > > > db2.aa.newip count > ------------ ------- > 10.10.10. 20 > 192.168.5. 40 > > I can parse two select statement to a perl script, but was wondering if this > can be done in a select statement. > > Thanks, > Rob > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]