I have a case about query in mysql.First i have a column called "cola" from table "abc" then i want to select or show it.This is what i do
我有一个关于mysql查询的案例。首先我从表“abc”有一个名为“cola”的列然后我想选择或显示它。这就是我做的
i assume that i have just only one data "a"
我假设我只有一个数据“a”
select cola from abc
it will show table like this :
它将显示如下表格:
------
|cola|
a
My question is what if i want to select the table and it shows many rows but same value like this
我的问题是,如果我想选择表,它显示许多行,但这样的值相同
------
|cola|
a
a
a
it shows 3
它显示3
what i know is just use limit
我知道的只是使用限制
select cola from abc limit 3
but doesnt work
但不起作用
thanks
1 个解决方案
#1
1
Use union:
select cola from abc
union all
select cola from abc
union all
select cola from abc
#1
1
Use union:
select cola from abc
union all
select cola from abc
union all
select cola from abc