SqlÓï¾äÎÊÌâ - ÆäËûÊý¾Ý¿â¿ª·¢ / MySQL/Postgresql
Àý:
insert into tablename values('select * from tablename')£»
ÎÒÏëÈÃselect * from tablenameÔÑùµÄ·Åµ½tablenameÖУ¬ÇëÎʸ÷룬sqlÎÄÔõô¸Ä°¡
select * from tablename ×÷Ϊ×Ö·û´®£¬²»ÈÃÆäÖ´ÐÐ!!
лл£¡£¡
insert into tablename select * from tablename
SQL code:
insert into tablename select 'select * from tablename';
SQL code:
insert into tablename (columnname) select 'select * from tablename';
insert into tablename(col1,col2...) select col1,col2... from tablename
ÈçºÎ¸Ä³ÉÁ½ÁÐÄØ£º
Àý:
insert into tablename(id,sqlstr) values(1,'select * from tablename')£»
ÎÒÏëÈÃselect * from tablenameÔÑùµÄ·Åµ½tablenameÖÐsqlstrÁУ¬ÇëÎʸ÷룬sqlÎÄÔõô¸Ä°¡
select * from tablename ×÷Ϊ×Ö·û´®£¬²»ÈÃÆäÖ´ÐÐ!!
лл£¡£¡
SQL code:
insert into tablename(id,sqlstr) select (1,'select * from tablename')£»
SQL code:
insert into tablename(id,sqlstr) select 1,'select * from tablename'
Ïà¹ØÎÊ´ð£º
sp ³ÌÐò
delimiter //
create procedure ma()
begin
declare i int default 0;
while i<11 do
set i=i+1;
select i;
end while;
end //
delimiter ;
1+2+...+9+10
ΪʲôÕâ¸ö³ÌÐòÎÞ·¨ÊµÏÖÀÛ¼ÓЧ¹û
/ ......
id name datetime
1 a 2010-05-13 10:15:00
2 b 2010-05-14 09:10:00
3 d 2010-05-14 10:10:00
ÈçºÎ½«¾àÀëÄ¿Ç°×î½üµÄÄǸö¼Ç¼µÄname ¸üÐÂΪ¡°x¡±ÄØ
лл¿© °¡ ºÇºÇ
update table_n ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ã棬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
SQL code:
rs.open "select * from guide where city_name='±±¾©' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
¡£¡£
¡£¡£
¡£¡£
rs.movenext
loop
Õâ¸ösqlÓï¾äÔÚwapÕ¾Àï ±¾ÉíÓÐ ......
Ö´ÐÐÊý¾Ý¿â²Ù×÷ʱ£¬Ö±½ÓÓÃSQL Óï¾äºÃһЩ »¹ÊÇÓô洢¹ý³Ì¸ü¼ÑÄØ£¿
¸÷ÊãÆð¼û
Õâ¸öµÄ¾ßÌåÎÊÌâ¾ßÌå·ÖÎö
¼òµ¥µÄselect ¡¢updateºÍinsertµ±È»sql½â¾öÁË
¸´ÔӵķÅÔÚsql·þÎñ¶ËÓ¦¸ÃºÃµã
Â¥Ö÷Çë²ÎÔÄ
http://msdn.micr ......