ÔÙ̸ Sql Á½ÐбäÒ»ÐРʵÀý
ÒªÇó£º °´ lct1£¬ lct2 ÅÅÐòºóµÄÇ°Á½Ìõ¼Í¼£¬ÏÔʾΪÏÂÁнá¹û£º
item_cd1 item_cd2 lct
01 a A01-3 B01-1
½¨±í×¼±¸£º
IF EXISTS (SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'm_lct_service')
DROP TABLE m_lct_service
GO
CREATE TABLE m_lct_service (
item_cd1 nvarchar(5) NOT NULL
,item_cd2 nvarchar(10) NOT NULL
,seq_no int NOT NULL
,lct1 nvarchar(3) NOT NULL
,lct2 nvarchar(3) NOT NULL
,stk_qty numeric(15,4)
,ins_emp_cd nvarchar(4) NOT NULL
,ins_date datetime NOT NULL
,upd_emp_cd nvarchar(4) NOT NULL
,upd_date datetime NOT NULL
,CONSTRAINT pk_m_lct_service PRIMARY KEY (
item_cd1
,item_cd2
,seq_no
,lct1
,lct2
)
)
GO
Êý¾Ý×¼±¸£º
item_cd1 item_cd2 seq_no lct1 lct2 stk_qty ins_emp_cd ins_date upd_emp_cd upd_date
01 a 1 A01 3 20.0000 fan 2010-01-02 00:00:00.000 fan 2010-01-02 00:00:00.000
01 a 2 B01 1 20.0000 fan 2010-01-02 00:00:00.000 fan 2010-01-02 00:00:00.000
01 a 3 B01 4 20.0000 fan 2010-01-02 00:00:00.000 fan 2010-01-02 00:00:00.000
ʵ¼ÊSql:
select item_cd1,item_cd2,
case when (AA <> BB)
then AA + ' ' + BB
else AA
end as lct
from(
select item_cd1,item_cd2,min(lct) as AA,
Ïà¹ØÎĵµ£º
UrlScanµÄ3.1ÊÇÒ»¸ö°²È«µÄ¹¤¾ß£¬ÏÞÖÆÁËIISµÄHTTPÇëÇ󽫴¦ÀíÀàÐÍ¡£ ͨ¹ý×èÖ¹Ìض¨µÄHTTPÇëÇó£¬ÔÚURLScan 3.1°²È«¹¤¾ßÓÐÖúÓÚ·ÀÖ¹¶Ô·þÎñÆ÷Ó¦ÓóÌÐò¿ÉÄÜÓꦵÄÇëÇó¡£ UrlScanµÄ3.1ÊÇURLScan 2.5µÄ¸üа汾¡£Ö§³ÖIIS 5.1ÖУ¬IIS 6.0ºÍIIS 7.0ÔÚWindows VistaºÍWindows Server 2008¡£ÏÂÔصØÖ·http://download.csdn.net ......
±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
(SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
from ±íÃû
ORDER BY ID))
ORDER BY ID
//×Ô¼º»¹¿ÉÒÔ¼ÓÉÏһЩ²éѯ ......
´Ó8iµ½10g£¬Oracle²»¶Ï½ø»¯×Ô¼ºµÄSQL TuningÖÇÄÜ£¬Ò»Ð©Ãؼ®¼¶µÄÓÅ»¯¿Ú¾÷ÒѾʧЧ¡£
µ«ÎÒϲ»¶Ê§Ð§£¬²»Óüǿھ÷£¬²Ù¸öToad for Oracle Xpert
£¬°´ÕÕ´ó·½ÏòÊæÊæ·þ·þµÄ
µ÷ÓŲÅÊÇ°®×öµÄÊÂÇé¡£
1.Excution Plan
Excution
PlanÊÇ×î»ù±¾µÄµ÷ÓŸÅÄ²»¹ÜÄãµÄµ÷ÓÅ´µµÃÈçºÎÌ ......
¿ÉÒÔɸѡÊý¾Ý£¬µ«²»ÄÜÊDZê×¼µÄSQLÓï¾ä£º
Me.DsUserManager1.Tables(0).Select("id > 5 and id <20")
---------------------------------------------------------------
1.ɸѡ£º
dataset.tables("tabname").select("id=1")'Ï൱ÓÚSQLÖÐWHEREºóµÄÌõ¼þÄÚÈÝ
2.±£´æµ½ÄÄ£¿Õâµ¹ÊDz»Öª ......