I thought delphi could only handle single sql queries, not multiples? Please correct me if Im wrong...
Chris > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Mark Howard > Sent: Friday, 17 January 2003 10:54 a.m. > To: Multiple recipients of list delphi > Subject: [DUG]: SQL Help > > > Hello > > I am trying to get a two part SQL query to work (D5, DBISAM) > > If I run the two parts in Steve Peacock's "20 Queries", I get > a result set: > but if I run them in my app as follows there is no result set. > > What am I doing wrong? > > TIA Mark > > SQL.Clear; > SQL.Add('Select d.LogCode, d.ForCode, d.DockType, d.Comp,'); > SQL.Add('d.SpeciesCode, sum(TruckLoad) SpecTot'); > SQL.Add('into t1'); > SQL.Add('from dockets d'); > SQL.Add('where DocketDate between :StartDate and :EndDate'); > SQL.Add('group by LogCode, ForCode, DockType, Comp, > SpeciesCode;'); > > SQL.Add('Select l.Logname, f.ForName,'); > SQL.Add('d.LogCode, d.ForCode, d.DockType, d.Comp, > d.SpeciesCode,'); > SQL.Add('d.Grade, sum(d.TruckLoad) GradeTot, t1.SpecTot'); > SQL.Add('from Dockets d'); > SQL.Add('join Logger l on d.LogCode = l.LogCode'); > SQL.Add('join Forest f on d.ForCode = f.ForCode'); > SQL.Add('join t1 on d.LogCode = t1.LogCode'); > SQL.Add('and d.ForCode = t1.ForCode'); > SQL.Add('and d.DockType = t1.DockType'); > SQL.Add('and d.Comp = t1.Comp'); > SQL.Add('and d.SpeciesCode = t1.SpeciesCode'); > SQL.Add('where DocketDate between :StartDate and :EndDate'); > SQL.Add('group by LogCode, ForCode, DockType, Comp, > SpeciesCode, Grade'); > ParamByName('StartDate').AsDate := Date1; > ParamByName('EndDate').AsDate := Date2; > Open; > -------------------------------------------------------------- > ------------- > New Zealand Delphi Users group - Delphi List - > [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/03 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/03 ______________________________________________________ The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. ______________________________________________________ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
