ÎʸöSQLÔõôд
ÏÖÔÚÓÐ2¸ö±í Group±í SQL code: GroupID GroupName 1 A×é 2 B×é UserGroup±í SQL code: ID UserID GroupID 1 3 1 2 4 1 ÏÖÔÚÎÒÏëÈ¡³öÕâÑùµÄÊý¾Ý GroupID GroupName Group±íÖеÄÓû§×ÜÊý ÎÒÊÇÕâÑùдµÄ SQL code: SELECT MAX(G.groupid) as groupid,MAX(groupname) as groupname,count(userid) AS groupcount from [Group] G JOIN UserGroup U ON G.groupid = U.groupid GROUP BY G.groupid µ«ÊÇÈ¡³öÀ´µÄÊý¾ÝÊÇÕâÑùµÄ SQL code: groupid groupname groupcount 1 A×é 2 µ«ÊÇÎÒÏëҪȡ³öÀ´µÄÊý¾ÝÊÇÕâÑùµÄ SQL code: groupid groupname groupcount 1 A×é 2 2 B×é 0 ÇëÎÊÓ¦¸ÃÔõôд£¿Ð»Ð»£¡
JOIN¸Ä³ÉLEFT JOINÒ
Ïà¹ØÎÊ´ð£º
±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½ÃæÈ¥Ñ§Ï° http://www.hxzi.com/view/61402.html B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......
½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿ 21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30 Ö¸µ ......
´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£ select * from ±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE WhereÆäËûÌõ¼þ select * ......
access ÖÐÖ´ÐÐsql updateÓï¾äʱÓÐʱºò³É¹¦ÓÐʱºò²»³É¹¦£¬µ«ÊÇaccessÖв»³ö´íÎóÐÅÏ¢£¬²»ÖªµÀÊÇʲôÔÒò£¬ÓÐÄÄλ´óÏÀÖªµÀ£¬Çë°ïæ°¡ ÌùSQLÓï¾ä£¬¼ì²é±í¡¢×ֶεÄÓÐЧÐÔÉèÖà sql ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæ Ö´ÐкÜÕý³£ ÊÇ ......