随笔-167  评论-65  文章-0  trackbacks-0

1,查询table中某个字段的值不是指定的值

String sql = "select * from students where getmoney != '0元' ";

2,查询table中某个字段的值不是null

String sql = "select * from students where getmoney is not null ";

3,查询一个table中的字段值在另一个表中的一个字段值存在

String sql = "select name,number,department,class,toschool from students where department = '"+department+"' and name in(select name from applys) ";

4,mysql 单表多字段查询

SELECT * FROM `magazine` WHERE CONCAT(`title`,`tag`,`description`) LIKE ‘%关键字%

5,sql server 单表多字段查询

String sql = "select * from students where name like '%"+keyword+"%' or number like '%"+keyword+"%'";

..........



write by feng
posted on 2009-06-02 17:17 fl1429 阅读(214) 评论(0)  编辑  收藏 所属分类: Mysql/Sqlserver/Oracle

只有注册用户登录后才能发表评论。


网站导航:
 
已访问数:
free counters