Sql»ù±¾Óï¾äµÄѧϰ
--²éѯÿ¸öÈ˶©·¹µÄ´ÎÊý
select username as ÐÕÃû, count(*) as ´ÎÊý from orderitems group by UserName having count(*)=1
order by ÐÕÃû desc
select distinct username as δע²áÐÕÃû from orderitems
where username not in (select [Name] from Person)
select distinct username as ÒÑ×¢²áÐÕÃû from orderitems where username
in (select [Name] from Person)
--Ë÷ÒýΪ31-40µÄÊý¾Ý
select top 10 * from orderitems where ID not in (select top 30 ID from orderitems)
--¸´ÖÆÊý¾Ý
insert into distinctselect(UserName,State,OrderTime) select UserName,State,OrderTime from orderitems
--È¥³ýËùÓÐÖØ¸´µÄ¼Ç¼(ÍêÈ«ÖØ¸´)
select distinct UserName ,ID, State,OrderTime into #Table1 from [distinctselect]
delete from [distinctselect]
insert into [distinctselect](UserName,State,OrderTime) select UserName,State,OrderTime from #Table1
drop table #Table1
--ɾ³ýijÁÐÖØ¸´µÄ¼Ç¼
delete t
from [distinctselect] t
where exists (
select 1 from [distinctselect] where username=t.username and id<t.id)
select * from [distinctselect] order by username
delete from [distinctselect]
Ïà¹ØÎĵµ£º
Ó¦ÓÃIDS·ÀÖ¹SQL×¢Èë¹¥»÷
http://www.cnhacker.com/Hacker/Skills/200807/t20080731_6187.html
Ŀǰ£¬Õë¶ÔÓ¦Óü°Æäºǫ́Êý¾Ý¿âµÄÓ¦Óü¶ÈëÇÖÒѾ±äµÃÔ½À´Ô½²þâ±£¬ÈçSQL×¢Èë¡¢¿çÕ¾µã½Å±¾¹¥»÷ºÍδ¾ÊÚȨµÄÓû§·ÃÎʵȡ£ËùÓÐÕâЩÈëÇÖ¶¼ÓпÉÄÜÈÆ¹ýǰ̨°²È«ÏµÍ³²¢¶ÔÊý¾ÝÀ´Ô´·¢Æð¹¥»÷¡£
ΪÁ˶Ը¶ÕâÀàÍþв£¬ÐÂÒ»¼¶±ðµÄ°²È«ÍÑÓ±¶ø³ö£ ......
Ò».×¢ÊÍ
-- µ¥ÐÐ×¢ÊÍ£¬´ÓÕâµ½±¾ÐнáÊøÎª×¢ÊÍsql Óï·¨£¬ÀàËÆC++£¬c#ÖÐ//
/* … */ ¶àÐÐ×¢ÊÍ£¬ÀàËÆC++£¬C#ÖÐ/* … */
¶þ.±äÁ¿£¨int£¬ smallint£¬ tinyint£¬ decimal£¬float£¬real£¬ money £¬smallmoneysql Óï·¨£¬ text £¬image£¬ char£¬ varchar¡£¡£¡£¡£¡£¡££©
Óï·¨£º
DECLARE
{
{@local_variable data_t ......
Èí¼þ £º Sql Server 2005
ÕâÀï²¢²»ÊÇSQLÓï·¨´óÈ«£¬ÒÔÏÂÊdz£ÓõÄÓï¾ä£¬¶Ô£¨Êý¾Ý¿â¡¢±í¡¢×ֶΡ¢Êý¾Ý£©µÄÔöɾ¸Ä²é£¬Èç¹ûÐèÒªÏêÏ¸È«ÃæµÄTransact-SQLÓï¾ä£¬¿ÉÒÔ²éSql ServerÁª»ú´ÔÊ飬ÄÇÀïÊÇ×îÈ«µÄ×ÊÁÏ£¬Ò»°ã°²×°Sql Server¶¼»áĬÈϰ²×°¡£
´ò¿ªSql ServerÁª»ú´ÔÊé
¿ªÊ¼ à ³ÌÐò à&n ......
ÕâÊÇ¡¶VC++¶¯Ì¬Á´½Ó¿â(DLL)±à³ÌÉîÈëdz³ö¡·µÄµÚËIJ¿·Ö£¬ÔĶÁ±¾ÎÄǰ£¬ÇëÏÈÔĶÁǰÈý²¿·Ö£º£¨Ò»£©
¡¢£¨¶þ£©
¡¢£¨Èý£©
¡£
¡¡¡¡MFCÀ©Õ¹DLLµÄÄںΪMFCµÄÀ©Õ¹£¬Óû§Ê¹ÓÃMFCÀ©Õ¹DLL¾ÍÏñʹÓÃMFC±¾ÉíµÄDLLÒ»Ñù¡£³ýÁË¿ÉÒÔÔÚMFCÀ©Õ¹DLLµÄÄÚ²¿Ê¹ÓÃMFCÒÔÍ⣬MFCÀ©Õ¹DLLÓëÓ¦ÓóÌÐòµÄ½Ó¿Ú²¿·ÖÒ²¿ÉÒÔÊÇMFC¡£ÎÒÃÇÒ»°ãʹÓÃMFCÀ©Õ¹DLLÀ´°üº¬ ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
from SC wher ......