ÇóSQLÓï¾ä - MS-SQL Server / »ù´¡Àà
TableA
id name math eng chinese
1 aaa 100 99 88
2 bbb 65 60 67
3 ccc 110 99 70
4 ddd 77 89 78
ÈçºÎÇó³ö³É¼¨º¬ÓÐ99µÄѧÉú(¾¡Á¿²»ÒªÐ´Ã¿¸ö×ֶΣ©
SQL code:
select distinct name
from
(
select name£¬math from TableA
union all
select name£¬eng from TableA
union all
select name£¬chinese from TableA
) tt
where math>99
SQL code:
create table #TT
(
id int identity(1,1) primary key,
name nvarchar(50),
math int,
eng int,
chinese int
)
insert into #TT select 'aaa',100,99,88
insert into #TT select 'bbb',65,60,67
insert into #TT select 'ccc',110,99,70
insert into #TT select 'ddd',77,89,78
select distinct name
from
(
select name,math from #TT
union all
select name,eng from #TT
union all
select name,chinese from #TT
) tt
where math=99
name
--------------------------------------------------
aaa
ccc
(2 ÐÐÊÜÓ°Ïì)
SQL code:
--------------------------------------------------------------------------
-- Author : h
Ïà¹ØÎÊ´ð£º
½ñÌì×öÁËÒ»¸ö´æ´¢¹ý³Ì »·¾³ÊÇSQL2000Êý¾Ý¿â
´óÖÂÈçÏÂ
½¨Á¢ÁÙʱ±í
¶¨ÒåÔ±¹¤Óαê
Ñ»·Ô±¹¤£¨ÊôÓÚ1¸ö¹«Ë¾)
......
ÎÒÊÇÔÚtoadÖÐÊäÈë϶Îsql
declare
TYPE test_rec IS record(
code varchar(10),
name varchar(30)
);
v_book test_rec;
......
select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001'
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......
ÈçºÎÔÚSQL2005ÖÐÉ趨¶¨Ê±×÷Òµ£¬±ÈÈç˵¶¨Ê±ÇåÀíijЩ±íµÄÊý¾Ý£¬
»òÕßÊǶ¨Ê±µÄ½«Ä³Ð©±íµÄÊý¾Ýµ¼³öexcel£¡
ÔÚÏߵȴý£¬¼±¼±¼±£¬×îºÃÊÇÏêϸ²½Ö裡
֮ǰÎÒ×öµÄ×÷ÒµÓеãÎÊÌ⣡
°ïUP
²Î¿¼:http://hi.baidu.com/toiota ......
tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......