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+"%'";
..........
posted on 2009-06-02 17:17
fl1429 閱讀(228)
評論(0) 編輯 收藏 所屬分類:
Mysql/Sqlserver/Oracle