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

Çó¸öSQLÓï¾ä - MS-SQL Server / ÒÉÄÑÎÊÌâ

A񡜧
thread_id msg_box read
1 4 1
2 1 1
3 1 0
4 1 1

B񡜧
_id read
2 0
3 1
4 1
5 1
6 0

ÎÒÏëÈ¡³öA±íÖÐreadΪ1ÓëB±íÖÐreadΪ1µÄ×ÜÊý
ÎÒµÄSQLÓï¾äÊÇÕâÑù£º
select count(*)+(select count(*) from b where read=1)
from a
where read=1

ÕâÑùȷʵ¿ÉÒÔÈ¡³öÀ´£¬µ«ÊÇÌ«±¿ÁË¡£¡£¡£ÓÐûÓÐʲôºÃµÄ·½·¨Âð£¿
²¹³äһϣ¬Á½±íÖ®¼äûÓÐÖ÷¼üÓëÍâ¼üµÄ¹ØÏµ

ÒýÓÃ
A񡜧
thread_id msg_box read
1 4 1
2 1 1
3 1 0
4 1 1

B񡜧
_id read
2 0
3 1
4 1
5 1
6 0

ÎÒÏëÈ¡³öA±íÖÐreadΪ1ÓëB±íÖÐreadΪ1µÄ×ÜÊý
ÎÒµÄSQLÓï¾äÊÇÕâÑù£º
select count(*)+(select count(*) from b where read=1)
fro¡­¡­
ÕâÖÖ·½·¨²»»á±¿


ÒýÓÃ

ÒýÓÃÂ¥Ö÷ furlxy µÄ»Ø¸´:
A񡜧
thread_id msg_box read
1 4 1
2 1 1
3 1 0
4 1 1

B񡜧
_id read
2 0
3 1
4 1
5 1
6 0

ÎÒÏëÈ¡³öA±íÖÐreadΪ1ÓëB±íÖÐreadΪ1µÄ×ÜÊý
ÎÒµÄSQLÓï¾äÊÇÕâÑù£º
select count(*)+(select count(*) from b¡­¡­

-¡£-ÊÇÂï

ÒýÓÃ
SQL code
select
count(1)
from
(
select read from a
union all
select read from b
)t

¶àл


Ïà¹ØÎÊ´ð£º

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......

SQLÈçºÎÓÅ»¯ÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ

½ñÌì×öÁËÒ»¸ö´æ´¢¹ý³Ì   »·¾³ÊÇSQL2000Êý¾Ý¿â  
´óÖÂÈçÏÂ
½¨Á¢ÁÙʱ±í
¶¨ÒåÔ±¹¤Óαê
        Ñ­»·Ô±¹¤£¨ÊôÓÚ1¸ö¹«Ë¾)  
        ......

ÇóÒ»¸öSQLÓï¾ä - MS-SQL Server / »ù´¡Àà

×Ö¶Î1,×Ö¶Î2.....×Ö¶ÎN,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
ÏëÒªµÄ½á¹ûÊÇ:
1,Na ......

vs2008 Á¬½Ómysql£¿ - MS-SQL Server / »ù´¡Àà

ÇëÎÊ
Ìí¼ÓÐÂÊý¾ÝÔ´->Êý¾Ý¿â->Ìí¼ÓÁ¬½Ó
Õâ¸ö½çÃæÏ£¬Êý¾ÝÔ´Ñ¡Ôñ£ºMicrosoft SQL Server (SqlClient)£»
·þÎñÆ÷Ãû£º
Ó¦¸ÃÐ´Ê²Ã´ÄØ£¿
ÓÐË­ÖªµÀ£¿¶àл¸÷λ£¡£¡
Äãµ½µ×ÊÇÒªÁ¬mysql»¹ÊÇmssql£¿

ÒýÓÃ
ÇëÎÊ
......

SQLÓï¾äÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ

Çë½Ì¸ßÊÖ£º
 ÒÔÏÂÊÇÊý¾Ý¿âÖеÄÈýÌõ¼Ç¼£¬Ó¢ÎÄΪ×Ö¶ÎÃû³Æ  
  id planname TaskBeginTime Status
329 2010Äê03 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ