дÁËÒ»¸öÉÔ΢¸´ÔÓµãµÄsqlÐĵÃ
select pcode from (
select h.k,h.d,h.m,h.u,l.areacode,
l.areacode||substr(h.u,4,length(h.u))||h.k pcode
from(
select j.k,j.d,j.m,j.u from(
select lpad(f,3,0) as k,d, m,u from(
select xx.areacode d,nvl(count(cy.pcode),'001')f,mx.m,mx.shopcode u
from cz_s_jtxx xx, cz_s_jtcy cy ,
( select a.m,d.shopid,d.shopcode from
(select shopid m,parentid from s_shop where shoptype=1) a,
(select shopid,parentid from s_shop where shoptype=2) b,
(select shopid,parentid from s_shop where shoptype=3)c,
(select shopid,parentid,shopcode from s_shop where shoptype=4)d
where d.parentid=c.shopid
and c.parentid=b.shopid
and b.parentid=a.m
and d.shopid=14725) mx
where xx.pcode = cy.pcode
and xx.areacode=mx.shopid
group by xx.areacode,mx.m,mx.shopcode))j)h,
(select areacode,shopid from cz_s_area) l
where h.m=l.shopid)
Ê×ÏÈ ´Ó×îÀï²ãµÄ sql˵Æð£º
select a.m,d.shopid,d.shopcode from
(select shopid m,parentid from s_shop where shoptype=1) a,
 
Ïà¹ØÎĵµ£º
(ÊÊÓà SQL Server 2005 ÆäËû°æ±¾)
ÊÕ²Ø
SQL Server 2005 Express ÊÇ΢ÈíÌṩµÄÊý¾Ý¿âµÄµÍ¶Ë½â¾ö·½°¸,
¿ÉÃâ·ÑÈÎÒâËæ²úÆ··Ö·¢, ¿ÉÒÔÔÚXPµÈ·Çרҵ·þÎñÆ÷ϵͳϰ²×°, »¹¿ÉÒÔÔ¶³Ì·ÃÎÊ, ¶ÔÓÚСÐÍÊý¾ÝÓ¦ÓóÌÐòÒÑ×ã¹»Âú×ãÊý¾ÝʹÓÃÒªÇó.
ĬÈϰ²×°ÏÂ,SQL Server ......
-- ˵Ã÷:
-- 1. Ҫɾ³ý±í table_name, ÐëÏÈÅжϸñíÊÇ·ñÕý±»Êý¾Ý¿âÖÐÆäËü±íËùÒýÓÃ.
-- 2. Èç¹ûδ±»ÒýÓÃ, ¿ÉÖ±½Ó DROP TABLE table_name; ·ñÔò±ØÐëÏÈɾ³ýÒýÓñíµÄÔ¼Êø, ÔÙ DROP TABLE table_name.
-- 3. ÁíÍâ, table_name ÊÇ·ñÕýÒýÓÃÆäËü±íµÄÇé¿öÎÞÐ뿼ÂÇ.
-- ´´½¨Ö÷±í
CREATE TABLE tParent
......
´æ´¢¹ý³Ì
==========================================================================
==========================================================================
¡¾ÑµÁ·15.1¡¿ ´´½¨Ò»¸öÏÔʾ¹ÍÔ±×ÜÈËÊýµÄ´æ´¢¹ý³Ì¡£
²½Öè1£ºµÇ¼SCOTTÕË»§(»òѧÉú¸öÈËÕË»§)¡£
²½Öè2£º ......
SQL Server 2008ÖеıíÖµÐͲÎÊý
×÷ÕߣºAl Tenhundfeld ÒëÕß Õź£Áú¡¡
±íÖµÐͲÎÊý£¨Table-valued parameters£©ÊÇSQL Server 2008ÖÐÒýÈëµÄÒ»ÖÖÐÂÌØÐÔ£¬ËüÌṩÁËÒ»ÖÖÄÚÖõķ½Ê½£¬Èÿͻ§¶ËÓ¦ÓÿÉÒÔֻͨ¹ýµ¥¶ÀµÄÒ»Ìõ²Î»¯ÊýSQLÓï¾ä£¬¾Í¿ÉÒÔÏòSQL Server·¢ËͶàÐÐÊý¾Ý¡£
±íÖ ......
¡¡×î½üÔÚÕÛÌÚ PHP + MYSQL
µÄ±à³Ì¡£Á˽âÁËһЩ PHP SQL ×¢Èë¹¥»÷
µÄ֪ʶ£¬ÓÚÊÇдÁËÕâÆªÎÄÕ¡¡http://www.xiaohui.com/weekly/20070314.htm£¬×ܽáһϾÑé¡£ÔÚÎÒ¿´À´£¬Òý·¢ SQL ×¢Èë¹¥»÷
µÄÖ÷ÒªÔÒò£¬ÊÇÒòΪÒÔÏÂÁ½µãÔÒò£º
¡¡¡¡1. php ÅäÖÃÎļþ php.ini ÖÐµÄ magic_quotes_gpc
Ñ¡ÏîûÓдò¿ª£¬±»ÖÃΪ off
¡¡¡¡2. ¿ª·¢ ......