我有 7 行的表;我想要一个查询,它将返回第二个查询中显示的值,使用表中的使用总行数,而不使用表名。
CREATE TABLE IF NOT EXISTS `graph_owner` (
`owner_id` int(5) NOT NULL AUTO_INCREMENT,
`owner_name` varchar(256) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`owner_id`)
);
INSERT INTO `graph_owner` (`owner_id`, `owner_name`) VALUES
(1, 'test1'),
(2, 'test2'),
(3, 'test3'),
(4, 'test4'),
(5, 'test5'),
(6, 'test6'),
(7, 'test6');
SELECT *
FROM (
SELECT 1 AS id
UNION SELECT 2
UNION SELECT 3
UNION SELECT 4
UNION SELECT 5
UNION SELECT 6
UNION SELECT 7
) AS t