sqlÓï¾äÎÊÌâ
ÄÜ·ñ½«ÏÂÃæÁ½¸öÓï¾äºÏ²¢ÔÚÒ»Æð£¬µÃµ½½á¹ûÒªÇó£º AutoIDÎªÆæ¡¢Å¼Êýʱ£¬ÔÚͬһ¼Ç¼·Ö±ðÒÔ²»Í¬µÄ×ֶΣ¨Newchar£¬Newchar1£©À´ÏÔʾ£¿ select Months as Newchar from vw_ReportMonthBankAccountAmount where AutoID % 2 <> 0 select Months as Newchar1 from vw_ReportMonthBankAccountAmount where AutoID % 2 = 0
SQL code: select case AutoID % 2 when 1 then Months end as Newchar, case AutoID % 2 when 0 then Months end as Newchar1, from vw_ReportMonthBankAccountAmount SQL code: select (select Months as Newchar from vw_ReportMonthBankAccountAmount where AutoID % 2 <> 0) Newchar , ( select Months as Newchar1 from vw_ReportMonthBankAccountAmount where AutoID % 2 = 0 ) 'Newchar1 ' from vw_ReportMonthBankAccountAmount case when À´ÅжÏÒýÓà SQL codeselectcase AutoID%2when1then Monthsendas Newchar,case AutoID%2when0then Monthsendas Newchar1,from vw_ReportMonthBankAccountAmount ÕâÑù»áµ±AutoIDÎªÆæÊýʱ£¬NewcharֵΪNull£¬ÎªÅ¼Êýʱ£¬Newchar1ΪNull,Èç¹û²»ÈÃËüÃDz»ÏÔʾNull£¿£¿ÒýÓà ÕâÑù»áµ±AutoIDÎªÆæÊýʱ£¬NewcharֵΪNull£¬ÎªÅ¼Êýʱ£¬Newchar1ΪNull,Èç¹û²»ÈÃËüÃDz»ÏÔʾNull£¿£¿ ÄãÏëÏ
Ïà¹ØÎÊ´ð£º
--drop table #T1 --drop table #T2 create Table #T1(ID int, QueryID nvarchar(20), ResultID1 nvarchar(20), ResultID2 nvarchar(20)) create Table #T2(SortNo int, QueryID nvarchar(20), ResultID1 nv ......
clientserial devseral chunnelnum devdata5 CZ0001 308001 5000 11.1 CZ0001 308001 5001 11.2 CZ0001 308001 5002 11.3 CZ0001 3080 ......
protected void btnLogin_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login"); &nb ......