Ò»µÀSqlÃæÊÔÌâÇó½â
Êý¾Ý¿â ÏÖÔÚÓбí1£¬±í2ÈçÏ£¬ÒªÇóÊä³ö±í3µÄÑù×Ó
Table1
yue dep yj
Ò»ÔÂ 1 10
¶þÔÂ 1 20
ÈýÔÂ 2 30
Table2
dep dep_name
1 ²¿ÃÅ1
2 ²¿ÃÅ2
3 ²¿ÃÅ3
4 ²¿ÃÅ4
Table3
dep Ò»ÔÂ ¶þÔÂ ÈýÔÂ
1
Table3
dep Ò»ÔÂ ¶þÔÂ ÈýÔÂ
1 10 20 null
2 null null 30
3 null null null
4 null null null
ÐÐתÁÐ
ÐÐתÁмÓÁ¬½Ó±í
SQL code:
if object_id('tb1')is not null drop table tb1
go
create table tb1(yue varchar(10), dep int, yj int)
insert tb1 select
'Ò»ÔÂ' , 1, 10 union all select
'¶þÔÂ', 1 , 20 union all select
'ÈýÔÂ' , 2 , 30
if object_id('tb2')is not null drop table tb2
go
create table tb2( dep int, dep_name varchar(10))
insert tb2 select
1, '²¿ÃÅ1' union all select
2, '²¿ÃÅ2'union all select
3, '²¿ÃÅ3' union all select
4, '²¿ÃÅ4'
select b.dep,
[Ò»ÔÂ]=max
Ïà¹ØÎÊ´ð£º
sql table±íÓиöÎı¾ÀàÐ͵Äa×ֶΣ¬´æ´¢µÄÄÚÈÝÈ«²¿ÊÇÊý×Ö£¬ÀýÈç2009001£¬2008578ÕâÑùµÄ¸ñʽ£»b×Ö¶ÎÎı¾ÀàÐÍ£¬´æµÄÒ²ÊÇÊý×ÖÀýÈç 001£¬123
aspÀïÃæ strday=100£¬strb=001
ÎÒÏë¶Á³ö£¬´Óa×ֶεÄÊý×Ö°´´óµ½Ð¡µÄË ......
СµÜÊǸöÐÂÊÖ ÏÖÔÚÓиöÎÊÌâÒ»Ö±²»Äܽâ¾ö
ÀýÈç
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
ÎÒEXCELÖÐÒ»¸öµ¥Ôª¸ñµÄÊý¾ÝÈç "2009-01","8949-232"
½«Õâ¸öÊý¾ÝÕ³Ìùµ½PL/SQLÖеÄÒ»¸ö±íÖкó,Êý¾ÝÈ·ÊdzÉΪÁË 2009-01,8949-232 ,°ÑËùÓеÄ""¶¼Ã»ÁË,
ÈçºÎÅªÄØ?Çë´ó¼ÒÊÔ ......
½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿
21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......