ÇóÒ»SQLÓï¾ä
ÔÊý¾Ý
ÉÌÆ· Ô¼Û ´òÕÛ·½Ê½1 ÕÛ¿Û1 ´òÕÛ·½Ê½2 ÕÛ¿Û2
±Ê¼Ç±¾ 10000 NULL 0 NULL 0
µçÊÓ»ú 2000 ´ÙÏú 200 NULL 0
±ùÏä 3000 ´ÙÏú 300 ÀÏ¿Í»§ 400
ÒªµÃ³ö½á¹û
ÉÌÆ· ´òÕÛ·½Ê½ ¼ÛÇ®
±Ê¼Ç±¾ NULL 10000
µçÊÓ»ú ´ÙÏú 2000
µçÊÓ¾ç ´ÙÏú -200
±ùÏä ´ÙÏú 3000
±ùÏä ´ÙÏú -300
±ùÏä ÀÏ¿Í»§ -400
ÐèÇóµÄ±È½ÏÆæ¹Ö¡£
´ó¸ÅÀ´Ëµ£¬Ã¿¸öÓÐЧµÄÕÛ¿Û£¬¶¼ÁíÍâÆðÒ»ÐУ¬²¢Ê¹ÓøºÊý±íʾ
ʵÏÖÆðÀ´±È½ÏÆæ¹Ö£¬¼Ó·Ö
union all
SQL code:
select ÉÌÆ· as ÉÌÆ· ,´òÕÛ·½Ê½1 as ´òÕÛ·½Ê½,Ô¼Û as ¼ÛÇ® from ±í
union all
select ÉÌÆ·,-´òÕÛ·½Ê½1,ÕÛ¿Û1 from ±í
union all
select ÉÌÆ·,-´òÕÛ·½Ê½2,ÕÛ¿Û2 from ±í
union all
Ïà¹ØÎÊ´ð£º
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and xxfwzf <>0 ),Ö´ÐÐËÙ¶ÈÂýµÄÒªËÀ£¬µ«ÊÇÈç¹û°Ñ(xxf>0 and ......
½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿
21-30ÊÇʲôÒâ˼£¿×ֶεĻ°¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......
ÔÚsqlÖÐʹÓÃoutputºÍ²»Ê¹ÓõÄÇø±ð£¿
ÀýÈ磺
ALTER PROCEDURE [dbo].[sp_1]
@SYS_LNNO varchar(20),
@SYS_CALLER varchar(20),
@SYS_ORGANIZE varchar(10), ......
£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......