当MySQL查询时排序的字段不是数字时而是汉字的时候也可以用when then 来指定排序. 列如yewu_check表的status 字段不是0,1,2而是汉字待办,已办,退回.可以如下写法: SELECT * FROM yewu_check ORDER BY CASE WHEN STATUS='待办' THEN 2 WHEN STATUS='已办' THEN 1 ELSE 0 END DESC 结果:
因为一直报实体类空异常,去网上查了资料只查到了并没有查到数据库空值时不给实体类赋值的属性 异常 org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/pojo/EmpDao.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:) at org.hibernate.cfg.Configur
() UNION () UNION (select i.create_time as time,i.investment_amount as amount,i.invest_state as state, b.bid_name as type from invest i INNER JOIN bid b on i.bid_id=b.bid_id ) UNION (select r.exact_repayment_time as time,r.should_repayment_amount as
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式.比如 select * from T_Employee where FNumber not in ( select top 5* from T_Employee order by FSalary desc)order by FSalary 在sql中执行出现错误 更正:select * from T_Employee where FNumber not in (select top 5 FNumber from T_Em
通常需要查询某个字段来自于哪张表,在navicat中没有直接查哪些表有指定字段名的功能,只能用sql来查. 1.(按字段名查表)查询哪些表有指定字段名(比如查字段名article_id)的SQL: SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='article_id'; 或者 SELECT table_name, column_name FROM information_schema.columns WHERE column