SQL ÿ¸ö·ÖÀà¸÷È¡2ÌõÊý¾Ý
create table tb (ptoid int,proclassid int,proname varchar(10))
insert tb
select 1,1,'Ò·þ1'
union all
select 2,2,'Ò·þ2'
union all
select 3,3,'Ò·þ3'
union all
select 4,3,'Ò·þ4'
union all
select 5,2,'Ò·þ5'
union all
select 6,2,'Ò·þ6'
union all
select 7,2,'Ò·þ7'
union all
select 8,1,'Ò·þ8'
select * from tb
ptoid proclassid proname
----------- ----------- ----------
1 1 Ò·þ1
2 2 Ò·þ2
3 3 Ò·þ3
4 3 Ò·þ4
5 2 Ò·þ5
6 2 Ò·þ6
7 2 Ò·þ7
8 1 Ò·þ8
£¨ËùÓ°ÏìµÄÐÐÊýΪ 8 ÐУ©
select * from tb a where
(select count(*) from tb b where b.proclassid=a.proclassid and b.ptoid>a.ptoid) <2
order by proclassid
ptoid proclassid proname
----------- ----------- ----------
1 1 Ò·þ1
8 1  
Ïà¹ØÎĵµ£º
string str = System.Configuration.ConfigurationManager.AppSettings["strconn"];
string sqlpwd = "select password from bg_user where username='" + username + "'";
MySqlConnection conn = new MySqlConnection(str);
MySqlCommand cmd=new MySqlCommand(sqlpwd,conn);
MySqlDataAdapter adr = new MySqlDataA ......
--A. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ±äÁ¿ÖеÄÎĵµÖÐɾ³ý½Úµã
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
<!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
Some text 1
<st ......
use Tempdb
go
if object_ID('fn_ACITEncryption') is not null
drop function fn_ACITEncryption
go
create function fn_ACITEncryption
(
@Str nvarchar(4000),--¼ÓÃܵÄ×Ö·û´®
@Flag bit=1,--1¡¢¼ÓÃÜ 0¡¢½âÃÜ
@Key nvarchar(50)--ÃÜÎÄ
)
returns nvarchar(4000)--這Àï¿É轉換 ......
SQL°´ÕÕÈÕ¡¢ÖÜ¡¢Ô¡¢Äêͳ¼ÆÊý¾Ý ÊÕ²Ø
ÎÄÕ²ο¼£ºhttp://www.cnblogs.com/wenbhappy/archive/2008/07/02/1233660.html
Èç:
±í:consume_record
×Ö¶Î:consume (moneyÀàÐÍ)
date (datetimeÀàÐÍ)
ÇëÎÊÔõôдËÄÌõsqlÓï¾ä·Ö±ð°´ÈÕ,°´ÖÜ,°´ÔÂ,°´¼¾Í³¼ÆÏû·Ñ×ÜÁ¿.
Èç:1ÔÂ 1200Ô ......
ÎÒÃǵÄSQLÓï¾äµÄÖ´Ðж¼ÊÇÓÉÒ»¸öÀàÀ´Íê³ÉµÄ£¡Õâ¸öÀà¾ÍÊÇSQLStatement£¬Õâ¸öÀà¾ÍÊÇÎÒÃÇÓÃÀ´Ö´ÐÐSQLÓï¾äµÄÀ࣬¸ÃÀàµÄʹÓÃÒ²ÊǷdz£¼òµ¥µÄ£¬ÎÒÃÇÖ»ÐèÒª¼ÇסÁ½¸öÊôÐÔÁ½¸ö·½·¨¡£ÎÒÃÇÀ´¿´Ò»Ï£¡
textÊôÐÔ£ºËùÒªÖ´ÐеÄSQLÓï¾ä£¬¸ÃÊôÐÔÊÇÒ»¸ö×Ö·û´®¸ñʽ£¬ËùÒÔÎÒÃǵÄSQLÓï¾ä¶¼ÊÇ×Ö·û´®£¡
sqlConnectionÊôÐÔ£º¸ÃÊôÐÔÊÇÉèÖÃSQLSt ......