Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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£¿£¿
ÄãÏëÏ


Ïà¹ØÎÊ´ð£º

ÇóÒ»ÌõSQL - MS-SQL Server / ÒÉÄÑÎÊÌâ

--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 ......

ÇóSQLÓï¾ä£¡£¡£¡ - MS-SQL Server / Ó¦ÓÃʵÀý

clientserial devseral chunnelnum devdata5
CZ0001 308001 5000 11.1
CZ0001 308001 5001 11.2
CZ0001 308001 5002 11.3
CZ0001 3080 ......

ASPÁ´½ÓSQLµÄ¼òµ¥µÇ½½çÃæ - .NET¼¼Êõ / ASP.NET

protected void btnLogin_Click(object sender, EventArgs e)
  {
  SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ