两条行不 set @last = 0; select concat(@last,'-',quantity), @last:=quantity from q order by quantity;
不懂, 用最笨的方法可不可以? 把每个条件分别用QUERY查询出来?
这样能得到你中间若干行的内容,如果要加上头尾两行,用union即可 其中num就是你的quantity,表名换成你的即可 当然需要mysql版本支持子查询,如果4.1以下需要另想办法了select a.num as begin, b.num as end from a1 a , a1 b where a.num= ( select max(num) from a1 where num<b.num ) order by a.num
set @last = 0;
select concat(@last,'-',quantity), @last:=quantity from q order by quantity;
用最笨的方法可不可以?
把每个条件分别用QUERY查询出来?
这样能得到你中间若干行的内容,如果要加上头尾两行,用union即可
其中num就是你的quantity,表名换成你的即可
当然需要mysql版本支持子查询,如果4.1以下需要另想办法了select a.num as begin, b.num as end
from a1 a , a1 b
where
a.num= (
select max(num) from a1 where num<b.num
)
order by a.num
$query=mysql_query("sql语句");
while(row=mysql_fetch_array($query)){
echo $row[]."-".$row[]
}
就列出
0-100
100-200
200-400
400-500
500
while(row=mysql_fetch_array($query)){
echo $i."-".$row[];
$i=$row[];
}