ÎÒÕâ¸öÐ޸ĵÄsqlÓï¾ä Ìáʾ´íÎó
Âé·³´ó¼Ò°ïÎÒ¿´ÏÂ
C# code:
shuju.ExcuteSql("update LX_product set pdcsl=pdcsl-" + int.Parse(tex.Text.Trim()) + ",pdxssl=pdxssl+" + int.Parse(tex.Text.Trim()) + " where pid=" + int.Parse(lid.CommandArgument.ToString()) + ""); ......
±íM:nsid,xm,xb,school
±ía:nsid,Ksdc--KsdcΪ¿¼ÊԵȴÎ,½öºÏ¸ñÓë²»ºÏ¸ñ£¬¼ÇÔØ¿ÆÄ¿a³É¼¨
±íb:nsid,Ksdc--KsdcΪ¿¼ÊԵȴÎ,½öºÏ¸ñÓë²»ºÏ¸ñ£¬¼ÇÔØ¿ÆÄ¿b³É¼¨
±íC:nsid,Ksdc--KsdcΪ¿¼ÊԵȴÎ,½öºÏ¸ñÓë²»ºÏ¸ñ£¬¼ÇÔØ¿ÆÄ¿c³É¼¨
Ò»¸önsidÔÚa¡¢b¡¢cÖпÉÄÜÓжàÌõ¼Ç¼£¬Ò²¿ÉÄÜûÓмǼ£¬µ«Ö»ÓÐÒ»Ìõ¡°ºÏ¸ñ¡±¼Ç¼¡£ ......
SQL code:
create table table_name
(
subjectId int, --¿Î³Ì
name nvarchar(20), --ÐÕÃû
score numeric(12,2), --·ÖÊý
class int --°à¼¶
)
²éѯ½á¹û£º
subjectId name score subjectId name score
1 xx 50 1 ......
±í
ID PROVINCE CITY
1 ¹ã¶« ¹ãÖÝ
2 ¹ã¶« ÉîÛÚ
3 ºþ±± Î人
½á¹û£º
ID PROVINCE
1 ¹ã¶«
3 ºþ±±
SQL code:
select distinct PROVINCE from tb
SQL code:
select *
from tb t
where ID =(select max(ID ) from tb where PROVINCE=t.PROVINCE)
ÒýÓÃ
SQL codeselectdistinct P ......
SQL code:
declare @tem_name varchar(50) --ÁÙʱ±íÃû
declare @content varchar(4000) --ÁÐÃû(ÄÚÈÝ)
declare @col varchar(20) --ÁÐÃû
declare @key varchar(20) --¹Ø¼ü´Ê
exec( 'update '+@tem_name+' set content=replace('+
@body+','+@flag+','+@col1+')')
ÁÙʱ±íÓУ¬ÓÐ×Ö¶ÎÁÐ content £ ......
ͬһ¸öÊý¾Ý¿âµÄ
ÓÐÁ½¸ö±íAºÍB
A.idÊÇ×Ô¶¯±àºÅµÄ£¬B.urlµÈÓÚA.id
ÏÖÔÚÏëÖªµÀÂú×ãA.id=B.urlµÄÊýÁ¿,¾ßÌåµã½²¾ÍÊÇÏëÇó£º
µ±A.id=1ʱ£¬B.url¹²Óм¸ÌõÐÅÏ¢Ò²ÊǵÈÓÚ1£»µ±A.id=2ʱ£¬B.url¹²Óм¸ÌõÐÅÏ¢Ò²ÊǵÈÓÚ2¡¢¡¢¡¢
ÎÒÓÃ
SELECT count(*) as num
from A,B
WHERE A.id=B.url
......