mysql

From S23Wiki
Revision as of 06:25, 30 November 2011 by DrOwl (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Also see: MySQL

<man>mysql</man>

  1. redirect Template:manpage


Usefull hints

Just some useful notes from different locations on the internet

Sort By IP address

From O'Reillys MySQL Cookbook:

SELECT ip FROM hostip
ORDER BY
SUBSTRING_INDEX(ip, '.', 1) + 0,
SUBSTRING_INDEX(SUBSTRING_INDEX(ip, '.', -3), '.', 1) + 0,
SUBSTRING_INDEX(SUBSTRING_INDEX(ip, '.', -2), '.', 1) + 0,
SUBSTRING_INDEX(ip, '.', -1) + 0;

or (MySQL 3.23.15 an above)

SELECT ip FROM hostip
ORDER BY INET_ATON(ip);