Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼±Ñ½£¡ÇóÒ»SQL£¡£¡

Èç±íÓÐIDºÍ״̬Á½¸ö×Ö¶Î
ID  State
1      1
1      1
2      1
2      0
2      1
3      1
3      0
4      1
5      0
6      1
6      1

²éÕÒ³öͬһID״̬¶¼ÊÇ1µÄËùÓÐID£¨1£¬4£¬6£©
ÏÈлл´ó¼ÒÁË¡£
select distinct id where State=1

ÎÒÕâ¸ö¹À¼ÆÐ§ÂÊ»áºÜµÍ¡£
²»¹ýÈç¹ûʵÔÚûµÄÓÃÁË£¬ ¾Í³¢ÊÔÏÂÕâ¸ö°É£º

SQL code:
select id from idAndState
where id=1 and state =1
except
select id from idAndState
where id=1 and state<>1



select distinct id where State=1

ÒýÓÃ
select distinct id where State=1


ÕâÑù³öÀ´µÄ½á¹ûÊÇ
1
2
3
4
6
ÎÒÒªµÄ½á¹ûÊÇ
1
4
6
¼´£ºµ±Ç°ID״̬±ØÐë¶¼ÊÇ1µÄ¡£


SQL code:
declare @t table (id varchar(50),state varchar(50))
insert into @t
select '1','1' union all
select '1','1' union all
select '2','1' union all
select '2','0' union all
select '2','1' union all
select '3','1' union a


Ïà¹ØÎÊ´ð£º

jspÁ´½Ósql2000µÄÒÉÎÊ£¿



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

Êý¾ÝÒÔxml¸ñʽ·µ»Ø - MS-SQL Server / Ó¦ÓÃʵÀý

´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......

ASPÁ´½ÓSQLµÄ¼òµ¥µÇ½½çÃæ - .NET¼¼Êõ / ASP.NET

protected void btnLogin_Click(object sender, EventArgs e)
  {
  SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......

sqlÓÅ»¯ - Oracle / »ù´¡ºÍ¹ÜÀí

select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001' 
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......

Á½¾äSQL²¢Ò»¾ä,ÓÐÎÊÌâ. - MS-SQL Server / »ù´¡Àà

µÚÒ»¾ä:
select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je
from ht left join gfdm on ht.gfdm=gfdm.gfdm 
 join jh on ht.htbh=jh.hth 
and ht.htbh not like'del%' and ht. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ