msyql select 1到1024

mysql select 1到1024;
SELECT
    TWO_1.num+TWO_2.num+TWO_4.num+TWO_8.num+TWO_16.num+TWO_32.num+
TWO_64.num+TWO_128.num+TWO_256.num+TWO_512.num num
FROM
    (SELECT 0 num UNION ALL SELECT 1 num) TWO_1
    cross JOIN (SELECT 0 num UNION ALL SELECT 2 num) TWO_2
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 4 num) TWO_4
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 8 num) TWO_8
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 16 num) TWO_16
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 32 num) TWO_32
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 64 num) TWO_64
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 128 num) TWO_128
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 256 num) TWO_256
    CROSS JOIN (SELECT 0 num UNION ALL SELECT 512 num) TWO_512

你可能感兴趣的:(mysql)