Difference between revisions of "MySQL"

Jump to navigation Jump to search
399 bytes added ,  09:35, 26 February 2010
→‎SELECT Rows: Added ORDER BY
m (→‎SELECT Rows: Added "JOIN")
(→‎SELECT Rows: Added ORDER BY)
Line 103: Line 103:
'''AS'''
'''AS'''
<source lang="mysql"> SELECT INET_NTOA(ip) AS ip, name FROM hosts; </source>
<source lang="mysql"> SELECT INET_NTOA(ip) AS ip, name FROM hosts; </source>
'''ORDER BY'''
<source lang="mysql"> SELECT INET_NTOA(ip) AS ip, name FROM hosts ORDER BY ip; </source>
NULL's can be a bit of pain as they tend to end up at the top, to force then to the bottom insert an additional <code>ISNULL(column)</code> for column your sorting by which has NULL values...
<source lang="mysql"> SELECT INET_NTOA(ip) AS ip, name FROM hosts ORDER BY ISNULL(ip), ip; </source>


=== JOIN ===
=== JOIN ===

Navigation menu