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

sqlÓï¾äÎÊÌâ

ÓÐÒ»¸ö±íAA
name  tj
1    a
1    b
1    c
2    a
2    d
3    b
ÒªÇóµ±tj×ֶεÄÖµ¼ÈµÈÓÚaÓÖµÈÓÚcʱ£¨tj = ¡®a¡¯ÓÖÒªtj = ¡®b¡¯£©
Ò²¾ÍÊÇ˵ÎҵIJéѯÌõ¼þÊÇa¡¢c£¬ÎÒÒª²éµÄ½á¹ûÊÇ1
SQL code:
select name from
(
select distinct name from aa where tj ='a'
union all
select distinct name from aa where tj ='b'
) t
group by name having count(1) = 2


SQL code:

select * from AA where tj='a' and tj='c'



ÒýÓÃ
SQL codeselect*from AAwhere tj='a'and tj='c'

Àí½â錯誤.´ó烏龜Õý½â.

ÒýÓÃ
SQL codeselect namefrom
(selectdistinct namefrom aawhere tj='a'unionallselectdistinct namefrom aawhere tj='b'
) tgroupby namehavingcount(1)=2


up

SQL code:
create table aa(name int, tj varchar(10))
insert into aa values(1 , 'a')
insert into aa values(1 , 'b')
insert into aa values(1 , 'c')
ins


Ïà¹ØÎÊ´ð£º

ÈçºÎÓÃc#£¬sql2000 ¿ª·¢c/sÏµĹ¤×÷Á÷£¿

±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½Ãæȥѧϰ
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......

Çë½Ìoracleµ¼³öµ½sql server2005

û¸É¹ýÕâÊ£¬Ò²²»ÖªµÀoracleÊý¾Ý¿âɶÑù£¬Çë½Ì´óϺÃǾßÌå²½ÖèÊÇʲô£¿ÐèҪעÒâЩʲô£¿


ORACLEÊý¾Ý¿âÀï±íµ¼ÈëSQL ServerÊý¾Ý¿â
   
  1¡¢ÔÚÄ¿µÄSQL ServerÊý¾Ý¿â·þÎñÆ÷ÉÏ°²×°ORAC ......

sql inÎÊÌâ

listidÊÇintÊý¾Ý
declare @listid nvarchar(100)
set @listid='(1,2,3,7,9,10)'
select * from forums where listid in(@listid)ʱÌáʾÈçÏ´íÎó£º
ÔÚ½« nvarchar Öµ '(1,2,3,7,9,10)' × ......

SQLÓï¾äÎÊÌâ

create trigger TR_Delete_pm_WorkCard
on pm_WorkCard
for delete
as
if @@rowcount=0 return
begin tran
  update pm_PlanEntry
  set FDispatchQty=t4.FDispatchQty - t1.FDispat ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ