°ï¿´Ò»¸öSQL²éѯ½á¹û - MS-SQL Server / »ù´¡Àà
/*
±íÀï3Ìõ¼Ç¼Ƭ¶Î£º
SORDER EDA BUN CUST NOUBA JITU0 APRICE
RR128254 0 1 CSZ003U CSZ004U 62.700 62.10000000
RR128254 0 2 CSZ003U CSZ004U 213.750 62.10000000
RR128254 0 3 CSZ003U CSZ004U 8.550 62.10000000
*/
select case when cust='chf001j'and nouba='chf001j' then ceiling(jitu0*aprice)
when right(cust,1)='j'and cust<>'chf001j'and nouba<>'chf001j'then round(jitu0*aprice,0)
else round(jitu0*aprice,2) end
from xract where sorder='RR128254'
--ÕÕÀíÓ¦³öÀ´ round(jitu0*aprice,2)µÄ½á¹û£¬µ«ÊÇÈ´³öÀ´ceiling(jitu0*aprice)µÄ½á¹û£¬Ôõô»ØÊ£¿
ÓеãõèõΣ¬²»ÖªµÀɶÔÒò¡£ÎÒÔÚÎÒ»úÆ÷ÉÏûÎÊÌ⣬³öÀ´ÕýÈ·½á¹û¶øÀ´¡£
ΪÁËÕýȷ˵Ã÷ÄãµÃµ½µÄ½á¹û£¬½«then ºó¶¼ÓÃ×Ö·û´®ÊÔÊÔ±ÈÈç then 'a' then 'b' else 'c'
Äã¿ÉÒÔÕâÑù²âÊÔ£¬¾ÍÖªµÀËü¶ÁÈ¡µÄÊÇÄĸöÖµ
select case when cust='chf001j'and nouba='chf001j' then 'a' when right(cust,1)='j'and cust<>'chf001j'and nouba<>'chf001j'then 'b'
else 'c' end
from xract where sorder='RR128254'
³öÀ´Ó¦¸ÃÊÇc
to 2Â¥£¬ÎÒÊÔ¹ýÁË£¬ÓÃ×Ö·û´®µÃµ½µÄ½á¹ûÊǶԵģ¬µ«Ò»ÓÃÕýʽµÄÓï¾ä¾Í²»ÐÐÁË¡£¼û¹í¡£
select
case when cust='chf001j'and nouba='chf001j' then 'a'
when right(cust,1)='j'and cust<>'chf001j'and nouba<>'chf001j'then 'b'
else 'c' end,
* from xract where sorder='RR128254'
³öÀ´ÊÇc
µ«ÓÃ
select case when cust='chf001j'and
Ïà¹ØÎÊ´ð£º
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......
sqlµÄÈí¼þÔÚÄÄÀï¿ÉÒÔÏ°¡£¡ÔÚÍøÉÏÕÒÁËÂù¶à¶¼Óò»ÁË°¡
Ëæ±ã¸ãÒ»D°æ°É£¬
ѸÀ×µÚÒ»¸ö¾Í¿ÉÒÔÓÃ
2000,2005¶¼ÕâÑù
http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......
½«Ò»¸ö²éѯÓï¾ä¸³¸øÒ»¸ö±äÁ¿£¬ÈçÏ£º
DECLARE @STR NVARCHAR(MAX)
SET @STR='SELECT * from SALE_PROD'
ÔõôÑù²ÅÄÜÖ´ÐÐËüÄØ£¿
Çë¸ßÊÖ£¬ÈÊÐÖ£¬ÏÀ½ã°ï°ïæ°¡
¶àл£¬¿ÉÒÔÀ²£¬¸ßÊÖ°¡
Ö±½ÓÖ´ÐоÍÐÐÁË
exec ......