日期:2014-05-18  浏览次数:20624 次

如何将字段以记录的形式列出?具体看内实例
现在有一个表:报纸价格表paper_price
字段为:
ID,1price,2price,3price,4price,5price,6price,7price
内容为:
1,100000,20000,3400000,348753,882121,392832,200000
2,120000,23000,3000000,218753,802121,312832,320000
......

如果我想搜索所有字段中大于400000的记录,以记录集形式,并可分页
如:
ID   price         price_day
1,   3400000     3price
1,882121       5price
2,   3000000     3price
2,   802121
......

怎么写呢,给个思路吧,谢谢

------解决方案--------------------
select id,1price price, '1price ' price_day from paper_price where 1price> 400000
union all
select id,2price price, '2price ' price_day from paper_price where 2price> 400000
union all
select id,3price price, '3price ' price_day from paper_price where 3price> 400000
union all
select id,4price price, '4price ' price_day from paper_price where 4price> 400000
union all
select id,5price price, '5price ' price_day from paper_price where 5price> 400000
union all
select id,6price price, '6price ' price_day from paper_price where 6price> 400000
union all
select id,7price price, '7price ' price_day from paper_price where 7price> 400000
union all

------解决方案--------------------
探讨
union all

------解决方案--------------------
探讨
select id,1price price, '1price ' price_day from paper_price where 1price> 400000
union all
select id,2price price, '2price ' price_day from paper_price where 2price> 400000
union all
select id,3price price, '3price ' price_day from paper_price where 3price> 400000
union all
select id,4price price, '4price ' price_day from pap…