sql ±¸Íü
**************************************
**** sql ²éѯ±¸Íü ****
**************************************
Ò»£ºÍâÁ¬½Ó£º
1¡¢×óÍâÁ¬½Ó£¨°Ñjoin×ó±ß±íÀïµÄËùÓÐÊý¾Ý¶¼²é³öÀ´¡£È»ºó°Ñjoin Óұ߱íÖеķûºÏÌõ¼þµÄÊý¾Ý¼ÓÔÚ×ó±ß±íµÄºóÃæ¡£¡£¡£¡££©
SELECT * from t_empl_info as a LEFT OUTER JOIN t_dept as b
ON a.dept_no=b.dept_id
--ͨ³£Çé¿öÏÂÊÇ£º×ó±ß±íÊǶ෽±í¡£Óұ߱íÊÇÒ»·½±í
--ÈýÕűíµÄ×óÍâÁ¬½Ó
SELECT *
from A left join B
on A.a=B.a
left join C on B.b = C.b;
Ïà¹ØÎĵµ£º
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......
Ôø¾Óöµ½ÕâÑùµÄÇé¿ö,ÔÚÊý¾Ý¿âµÄMeeting±íÖÐÓÐPublishTime (DateTime,8)×Ö¶Î,ÓÃÀ´´æ´¢Ò»¸ö¿ª»áʱ¼ä,ÔÚ´æÈëʱÓÉÓÚÒªÖ¸Ã÷¿ª»á¾ßÌåʱ¼ä,¹Ê¸ñʽΪyyyy-mm-dd hh:mm:ss,¶øÎÒÃDzéѯʱÊÇͨ¹ýyyyy-mm-ddÀ´½øÐеÄ,¼´²éѯijһÌìµÄËùÓлáÒéÐÅÏ¢,ÕâÑùÈç¹ûͨ¹ýselect * from Meeting where PublishTime=@PublishTime (²ÎÊý@PublishTimeΪy ......
-
´¦Àí±íÖØ¸´¼Ç¼(²éѯºÍɾ³ý)
/*
*****************************************************************************************************************************************************
1¡¢Num¡¢NameÏàͬµÄÖØ¸´Öµ¼Ç¼,ûÓдóС¹ØÏµÖ»±£ÁôÒ»Ìõ
2¡¢NameÏàͬ,IDÓдóС¹ØÏµÊ±,±£Áô´ó»òСÆäÖÐÒ»¸ö¼Ç¼
ÕûÀíÈË£ºÖÐ ......
×î½ü¸Õѧ»áÔÚVB2008 ÖÐʹÓòÎÊý»¯SQLÓï¾ä£¬ÓÚÊÇÂíÉÏÓõ½´úÂëÖУ¬È´Åöµ½²é²»µ½ÈκÎÊý¾ÝµÄÇé¿ö£¬¾À½áÁ˺ü¸Ì죬»¹ÊÇûÓиãÃ÷°×£¬²îµãÍÂѪ¡£²»µÃÒÑ»¹ÊÇÏÈÔÚ´úÂëÖÐʹÓÃ×Ö·û´®Æ´½ÓµÄSQLÓï¾ä¡£
°üº¬²ÎÊý»¯SQLÓï¾äµÄ´úÂëÈçÏ£º
Dim cmSl As N ......
protected void Button1_Click(object sender, EventArgs e)
{
string strsql = "select * from TreeViewTemp where parentID=0";
DataTable dt = db.GetDataTable(strsql);
StringWriter sw = new StringWriter();
//StreamWriter sw = new Strea ......