mysql 数据库中as 和where用法


CREATE TABLE `commoncore` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `CCorder` int(11) default NULL,
  `CCIndex` text,
  `Standard` text,
  `Grade` text,
  `Strand` text,
  `Cluster` text,
  `Standard #` text,
  `Cluster2` text,
  `importData` text,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;这是表结构

select * from commoncore limit 0 , 495 可以查出来表的第一条开始 一共495条数据

 

SELECT Grade  FROM `commoncore` where Grade is not null GROUP BY Grade ORDER BY CAST( Grade AS UNSIGNED ) , Grade查出表grade字段 然后排序 我的gade 是text类型的 查出来的结果是k k12 1,2,3,4,5.。。。。。

 

select com.grade from  (select * from commoncore limit 1,495) as com where com.grade is not null  group by com.grade order by cast(grade as unsigned),com.grade查出来表的前495条数据 并排序

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM