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

ÇóÒ»ÌõSQLÓï¾ä

TableA


id name type company
1 СÃ÷ type_a ¹«Ë¾1
2 СÍõ type_b ¹«Ë¾1




TableB  
id type_a type_b type_c company
1 11 43 88 ¹«Ë¾1
2 33 55 78 ¹«Ë¾2

ÏëµÃµ½µÄ½á¹û

id name type company
1 СÃ÷ 11 ¹«Ë¾1
2 СÍõ 43 ¹«Ë¾1
SQL code:
select a.id,a.name,b.type,b.company
from tablea a,tableb
where a.id=b.id



SQL code:
select a.id,a.name,b.type_a as type,a.company from table1 a join table2 on a.company=b.company
union all
select a.id,a.name,b.type_b as type,a.company from table1 a join table2 on a.company=b.company


1Â¥µÄ¼ò½à£¬ºÃ
1Â¥µÄ¼ò½à£¬ºÃ

SQL code:

select id, name,
case a.when 'type_a' then b.type_a when 'type_b' then b.type_b else type_c end, company
from tablea a,tableb b
where a.id=b.id



ÒýÓÃ
SQL code
select a.id,a.name,b.type_a as type,a.company from tablea a join tableb on a.company=b.company
union all
select a.id,a.name,b.type_b as type,a.compa


Ïà¹ØÎÊ´ð£º

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

Ò»¸öpl/sqlÎÊÌâ - Oracle / ¿ª·¢

ÎÒÊÇÔÚtoadÖÐÊäÈë϶Îsql
  declare
  TYPE test_rec IS record(
  code varchar(10),
  name varchar(30)
  );
  v_book test_rec;
    ......

sqlÓÅ»¯ - Oracle / »ù´¡ºÍ¹ÜÀí

select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001' 
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......

sqlserver´íÎó - MS-SQL Server / ÒÉÄÑÎÊÌâ

sqlserver2005 ½¨Á¢µÄÊý¾Ý¿â£¬ÓëÊÖ³Öpda´«ÊäÊý¾Ý£¬×î½üͻȻ³öÏÖÎÞ·¨´«µÝÊý¾ÝµÄÎÊÌ⣬pda¶ËÌáʾµÄ´íÎóʱoutofmemoryexception£¬µ«ÊÇpdaÉÏÃæµÄÈÝÁ¿Ã»ÓÐÎÊÌ⣬
sqlserverµÄÈÕ×ÓÉϵĴíÎóÈçÏ£º
ÈÕÆÚ 2010-1-25 14:45: ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ