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

fastreport´òÓ¡´úÂë¼°SQLºÏ²¢×ֶεÄÓï¾ä

 procedure Tform1.Button5Click(Sender: TObject);
var
  p:pointer;
  FrfStr:string;
begin
  inherited;
  Screen.Cursor:=MYCURSORWAITHAND;
  with cdsPrint do
  begin
    Active:=false;
    //Õâ¸öSQLÓÃÓÚ½«remarkÖеļǼºÏ²¢µ½Ò»Æð!
    CommandText:='select a.ITEM_ID, a.ITEM_NAME,count(a.Coll_ID) as num,ltrim(max(sys_connect_by_path(a.remark, '';'')), '';'') remark '
      +' from (select /*+index(b,TAB_ORDER_I)*/ b.ITEM_ID,b.Coll_ID,b.ITEM_NAME,b.remark,row_number() over(partition by b.ITEM_ID order by b.ITEM_ID)'
      +' ITEM_ID1,row_number() over(order by b.ITEM_ID) + dense_rank() over(order by b.ITEM_ID) ITEM_ID2 '
      +' from TAB_ORDER b  where  b.Coll_ID ='''+DBComboBoxEh1.Text+''''
      +'  ) a'
      +' start with ITEM_ID1 = 1 connect by prior ITEM_ID2 = ITEM_ID2-1 group by a.ITEM_ID,'
      +' a.ITEM_NAME order by a.ITEM_ID ';
    Active:=true ;
  end;
  cds_Print.DisableControls;
  p:=cdsPrint.GetBookmark;
  FrfStr:='report1l.frf';
  try
    if cdsPrint.Active and (cdsPrint.RecordCount<>0) then
    begin
      frReport1.LoadfromFile(ExtractFilePath(ParamStr(0))+'Report\'+FrfStr);
      PrintSet;
      frReport1.ShowReport;
    end
    else
    begin
      Screen.Cursor:=crDefault;
      Application.MessageBox(pchar(STR_MESSAGEBOX_HEADER+'ûÓÐÊý¾Ý¿É´òÓ¡'),pchar(self.Caption),MB_OK or MB_ICONEXCLAMATION);
    end;
  finally
    cdsPrint.GotoBookmark(p);
    cdsPrint.EnableControls;
 &nb


Ïà¹ØÎĵµ£º

Êý¾Ý¿âSQLÓï¾äʹÓã¨Ò»£©

  Êý¾Ý¿âsqlÓï¾äϵÁж¼ÊÇÒÔÏÂÃæµÄ±íΪ»ù´¡µÄ
1.       д³ö²½Öè4Öеĸ÷Ïî²Ù×÷µÄSQLÓï¾ä¡£
¢Ù ¸øÑ§Éú±íÔö¼ÓÒ»ÊôÐÔNation£¨Ãñ×壩£¬Êý¾ÝÀàÐÍΪVarchar£¨20£©£»
alter table Student add Nation varchar(20);
 
¢Ú ɾ³ýѧÉú±íÖÐÐÂÔöµÄÊôÐÔNation£»
alter table Student DR ......

SQL ÖÐ where 1=1 ºÍ 1=0µÄ ×÷ÓÃ

where 1=1ÓÐʲôÓã¿ÔÚSQLÓïÑÔÖУ¬Ð´Õâôһ¾ä»°¾Í¸úûдһÑù¡£
select * from table1 where 1=1Óëselect * from table1ÍêȫûÓÐÇø±ð£¬ÉõÖÁ»¹ÓÐÆäËûÐí¶àд·¨£¬1<>2£¬'a'='a','a'<>'b'£¬ÆäÄ¿µÄ¾ÍÖ»ÓÐÒ»¸ö£¬whereµÄÌõ¼þΪÓÀÕæ£¬µÃµ½µÄ½á¹û¾ÍÊÇδ¼ÓÔ¼ÊøÌõ¼þµÄ¡£
ÔÚSQL×¢Èëʱ»áÓõ½Õâ¸ö£¬ÀýÈçselect * from table1 ......

SQL¾Û¼¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷Òý


΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
¡¡¡¡(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ ......

sql sa怬

 ÎÊÌâÒ»¡¢Íü¼ÇÁ˵ǼMicrosoft SQL Server 2005 µÄsaµÄµÇ¼ÃÜÂë
½â¾ö·½·¨£ºÏÈÓÃwindowsÉí·ÝÑéÖ¤µÄ·½Ê½µÇ¼½øÈ¥£¬È»ºóÔÚ‘°²È«ÐÔ’-‘µÇ¼’-ÓÒ¼üµ¥»÷‘sa’-‘ÊôÐÔ’£¬ÐÞ¸ÄÃÜÂëµã»÷È·¶¨¾Í¿ÉÒÔÁË¡£
ÎÊÌâ¶þ¡¢Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹ ......

sybaseÊý¾Ý¿âÖÐË÷Òýµ¼ÖÂsqlÓï¾äÖ´Ðв»³É¹¦

SELECT DISTINCT A.CASEPROP AS PROP,'¾É´æ' AS AJLX,0 AS AJLXXH,A.CASE_PROP AS PROPNO 
 ,M1=( SELECT COUNT(*) from CASES WHERE CASEPROP=A.CASEPROP AND
(PERMITDAY <'2008.12.26 00:00:00' AND (SHUTDAY IS NULL OR
SHUTDAY<'1900-01-01 00:00:00' OR SHUTDAY>='2008.12.26 00:00:00') )) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ