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

Çó¸ösqlÓï¾ä£¬¹À¼ÆÓеãÄÑŶ

±ío

id mid a  b    c    d    e
1  1  0.1 0.2  0.3  0.4  0.5
2  2  0.2 0.1  0.4  0.2  0.1

±íst 
id  mid  type value  time 
1  1      f    1.1  2009-10-09 12:12:00
2  1      f    1.2  2009-10-09 12:14:00
3  2      g    2.1  2009-10-09 12:11:00
4  2      f    1.3  2009-10-09 12:12:00
5  1      g    1.3  2009-10-09 12:13:00


Á½¸ö±í ÒÔ mid ¹ØÁªÏ£ÍûselectµÄ½á¹ûÈçÏÂ

id  mid  a    b  c    d    e  f  g 
1  1    0.1  0.2  0.3 0.4  0.5 1.2 1.3
2  2    0.2  0.1  0.4 0.2  0.1 1.3 2.1


f ºÍg ÊÇ stÀï ʱ¼ä ʱ¼ä±È½Ï´óµÄ¡£


SQL code:
select o.*,
(select `value` from st where mid=o.mid and type='f' order by `time` desc limit 1) as f,
(select `value` from st where mid=o.mid and type='g' order by `time` desc limit 1) as g
from o


order by time desc limit 1


Ïà¹ØÎÊ´ð£º

ÈçºÎÓÃc#£¬sql2000 ¿ª·¢c/sÏµĹ¤×÷Á÷£¿

±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½ÃæÈ¥Ñ§Ï°
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......

×Ü»áÅöµ½¹ÖµÄÎÊÌ⣬sqlÎÊÌâ

sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and  xxfwzf <>0 ),Ö´ÐÐËÙ¶ÈÂýµÄÒªËÀ£¬µ«ÊÇÈç¹û°Ñ(xxf>0 and  ......

sql ÎÊÌâ

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......

C#ÈçºÎÅжÏÁ¬½Ósql serverÊý¾Ý¿â³É¹¦£¿

C#ÈçºÎÅжÏÁ¬½Ósql serverÊý¾Ý¿â³É¹¦£¿
try
{
connection.connect()
return true;
}
catch()
{
return false;
}

Â¥Ö÷ºÜ׿±£¬¿ªÁ˼¸ÌùÁË¡£

ÒýÓÃ
try
{
connection.connect( ......

sqlÓï¾äÖÐÄܲ»ÄÜÕâÑùÅÅÐò£¿

Êý¾Ý±í¡¾biao¡¿£¬
×ֶΣºid¡¢myname¡¢mytxt
mytxtÄÚÈݸñʽÐÎÈ磺n|abcd¡££¨ÀýÈ磺1|ÁõµÂ»ª£¬2|Èδﻪ£¬3|αÌϼ£¬4|Âõ¿Ë@½Ü¿ËÑ·£©

ÎÒÏÖÔÚÏ£Íû¶Á¼Ç¼³öÀ´ºó£¬°´ÕÕ[mytxt]×Ö¶ÎÀïµÄÊúÏߣ¨|£©Ç°ÃæµÄÄǸöÊý× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ