sqlÖظ´Êý¾Ý´¦Àí£¬ÓÐΨһID£¬formidÓÐÖظ´,ÁôÒ»Ìõ
/*sqlÖظ´Êý¾Ý´¦Àí£¬ÓÐΨһID£¬formidÓÐÖظ´*/
/*²é³öÖظ´µÄfromid*/
select formid from GaiaSaver_BUG group by formid having count(*)>1
/*ɾ³ýÖظ´formid£¬Ö»ÁôÒ»Ìõ*/
delete from GaiaSaver_BUG where ID not in
(select min(ID) as ID from GaiaSaver_BUG group by formid)
Ïà¹ØÎĵµ£º
1, ʲôÊÇͳ¼ÆÐÅÏ¢
ÒÔÏÂÊǹٷ½µÄ¶Ôͳ¼ÆÐÅÏ¢µÄÃèÊö£º
°´ÕÕĬÈÏÉèÖã¬Èç¹û±íÖеÄijÁÐûÓÐË÷Òý£¬ÔòSQL Server»á×Ô¶¯Îª¸ÃÁд´½¨Í³¼Æ¡£È»ºó£¬²éѯÓÅ»¯Æ÷ÆÀ¹À¸ÃÁÐÖÐÊý¾Ý·Ö²¼·¶Î§µÄͳ¼ÆÐÅÏ¢£¬ÒÔÑ¡ÔñÒ»¸ö¸üΪÓÐЧµÄ²éѯ´¦Àí·½°¸¡£·Ö±æ×Ô¶¯´´½¨µÄͳ¼ÆºÜ¼òµ¥£¬ÔÚSQL Serve ......
SQLÖÐWHERE×Ó¾äÖпÉÒÔÀûÓÃLIKEÀ´Æ¥ÅäÏàËƵÄÊý¾ÝÏµ±Ê±Îҵõ½µÄ½áÂÛÊÇ¿ÉÒÔʹÓÃ"%"À´Æ¥Åä×Ö·û´®£¬ÔÚSPUFIÖÐʹÓ㬵ÄÈ·¿ÉÒԵõ½×Ö·û´®Æ¥ÅäµÄЧ¹û¡£È磺
SELECT * from TEST
WHERE TESTID LIKE "CZX%";
ÉÏÃæÕâ¾äÔÚSPUFIÖÐÌ ......
Êý¾Ý¿â£º
1¡¢ ´´½¨Êý¾Ý¿âµÄÓï·¨£º
if exists (select * from sysdatabases where name='DT_name') /*ÅжÏÊÇ·ñ´æÔÚ£¬ÊÇÔòɾ³ý*/
drop database DT_name
create database database_name
on primary /* Ö¸¶¨Ö÷ÒªÎļþ×飬ÆäÖеÚÒ»¸öÖ÷ÒªÎļþ * ......
RDBMS
·½ÑÔ
DB2
org.hibernate.dialect.DB2Dialect
DB2 AS/400
org.hibernate.dialect.DB2400Dialect
DB2 OS390
org.hibernate.dialect.DB2390Dialect
PostgreSQL
org.hib ......
½éÉÜGROUP BY ºÍ HAVING ×Ó¾äÇ°£¬ÎÒÃDZØÐèÏȽ²½²sqlÓïÑÔÖÐÒ»ÖÖÌØÊâµÄº¯Êý:¾ÛºÏº¯Êý£¬ÀýÈçSUM, COUNT, MAX, AVGµÈ¡£ÕâЩº¯ÊýºÍÆäËüº¯ÊýµÄ¸ù±¾Çø±ð¾ÍÊÇËüÃÇÒ»°ã×÷ÓÃÔÚ¶àÌõ¼Ç¼ÉÏ¡£
SELECT SUM(population) from bbc
ÕâÀïµÄSUM×÷ÓÃÔÚËùÓзµ»Ø¼Ç¼µÄpopulation×Ö¶ÎÉÏ£¬½á¹û¾ÍÊǸòéѯֻ·µ»ØÒ»¸ö½á¹û£¬¼´ËùÓйú¼ÒµÄ×ÜÈË¿ ......