sql ·ÖÒ³¼¼Êõ
·ÖÒ³Óï¾ä
sqlserver ·½°¸1: select top 10 * from t where id not in(select top 30 id from t order by id) order by id
·½°¸2£º select top 10 * from t where id in (select top 40 id from t order by id)oder by id desc
mysql: select * from t order by id limit 30,10
oracle: select * from (select rownum r * from t where r<=40)where r>30
·ÖÒ³¼¼Êõ:
mysql: sql ="select * from articles limit" +(pageNo-1)*pageSize + "," +pageSize;
oracle: sql="select * from " + "(select rownum r,* from" +"(select * from articles order by posttime desc)" + "where rownum <= " +pageNo *pageSize")tmp" + "where r>" +(pageNo-1)*pageSize";
sqlserver:sql = "select top 10 * from id not id(select top " + (pageNo-1)*pageSize + "id from articles)"
DataSource ds = new InitialContext().lookup(jndiurl); Connection cn = ds.getConnection(); //"select * from user where id=?" --->binary directive PreparedStatement pstmt = cn.prepareSatement(sql); ResultSet rs = pstmt.executeQuery() while(rs.next()) { out.println(rs.getString(1)); }
Ïà¹ØÎĵµ£º
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬ char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......
<%
SQL1 = "update table1 set a=b where id=1"
Conn.ExeCute SQL1
SQL2 = "update table2 set a=b where id=2"
Conn.ExeCute SQL2
SQL3 = "update table3 set a=b where id=3"
Conn.ExeCute SQL3
%>
&nb ......
ÕâƪÎÄÕÂÊÇÐþ»úÒÝʿΪijÉÏÊй«Ë¾µÄERPϵͳµ÷ÓÅËù׫д±¨¸æµÄ²¿·Öժ¼£¬Ï£ÍûÄܹ»¶Ô´ó¼ÒÓÐËù°ïÖú£º
ÏÂÃæ¸ø³öSQLÓÅ»¯¾³£Óöµ½µÄÇéÐΡ£ËüÃÇÊÇÔںܶàÈ˳¤ÆÚ»ýÀ۵ľÑéÉÏ×ܽá³öÀ´µÄ£¬ÕâЩ¶¼ÊÇһЩһ°ãÐԵĽáÂÛ£¬ÔÚʵ¼Ê¹¤×÷ÖУ¬»¹Ó¦µ±¾ßÌåÇé¿ö¾ßÌå·ÖÎö£¬²¢¼ÓÒÔÁé»îÔËÓá£
(1) ÓÃNOT EXISTSÌæ»»NOT IN ½«¸üÏÔÖøµØÌá¸ßЧÂÊ£¬¾ ......