SQL - 基本的SELECT语句

时间:2016-09-24 16:39:33

标签: mysql sql

我想在sql中创建这个结构(作为SELECT语句的结果):

enter image description here

我正在尝试使用此查询:

SELECT "Name" AS School, (SELECT 20 AS "1", 50 AS "2", 90 AS "3") AS Age;

但它不起作用,错误:Operand should contain 1 column(s)。是否可以仅使用select语句创建这样的东西?

1 个答案:

答案 0 :(得分:2)

SQL中无法使用格式,但这是可能的

SELECT 'Name' AS School, 20 AS `Age1`, 50 AS `Age2`, 90 AS `Age3`