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