🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mailing.database.mysql
Article #1

SQL-calls to 2 databases

#1
From: Peder
Date: Mon, 16 Jul 2001 08:49
52 lines
2772 bytes
Dear group,

I hope someone can help me out...

I call a SQL-database to get starttime and endtime for a process on a given 
product (=LotID)

To find the starttime:

  Select LotID, LotBaseLog.TransactionName, RouteStepName, 
ResourceBaseLog.TimeLogged 
  from Lotbaselog, ResourceBaseLog 
  where LotId like '0105M3'
  and RouteStepName=1
  and Lotbaselog.timelogged=ResourceBaseLog.timelogged 

The result could be:

  LotID    TransactionName   RouteStepName  TimeLogged
  0105M3    START            1             22-06-01 13:14:34

To find the endtime:

  Select LotID, LotBaseLog.TransactionName, RouteStepName, 
ResourceBaseLog.TimeLogged 
  from Lotbaselog, ResourceBaseLog 
  where LotId like '0105M3'
  and LotBaseLog.TransactionName='COMPLETE'
  and Lotbaselog.timelogged=ResourceBaseLog.timelogged 

The result of this could be:

  LotID   TransactionName   RouteStepName   TimeLogged
  0105M3    COMPLETE       2               22-06-01 14:10:53

Then I use these times (TimeLogged) to call another database on the same 
server. For this I need to use ODBC:

  SELECT * FROM OpenQuery(INSQL,"
  SELECT DateTime, DIR01_B1G, DIR01_B1S, DIR01_B2W, DIR01_B3G
  FROM Runtime.dbo.AnalogWideHistory
  WHERE DateTime >= '22-06-01 13:14:34'
  AND DateTime <= '22-06-01 14:10:53'
  and wwresolution=100
  ")

The result is a textfile with the columns of data that I need.

I need to do this maneuvre in one go, and not via many calls. Is there a way to 
do this? 

mvh Peder / www.nst.com
Technical Details
Message-ID: <6Ux47.373$5Z5.4872@news.get2net.dk>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.213.69.151!news.algonet.se!algonet!newsfeed1.uni2.dk!news.get2net.dk!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fd8a0,a6924d2d1ce1b255,start
X-Google-Attributes: gidfd8a0,public
X-Google-Thread: 104de1,a6924d2d1ce1b255,start
X-Google-Attributes: gid104de1,public
X-Google-Thread: 109779,a6924d2d1ce1b255,start
X-Google-Attributes: gid109779,public
X-Google-Thread: 10de66,a6924d2d1ce1b255,start
X-Google-Attributes: gid10de66,public
X-Google-ArrivalTime: 2001-07-16 01:49:07 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.213.69.151!news.algonet.se!algonet!newsfeed1.uni2.dk!news.get2net.dk!not-for-mail
Newsgroups: mailing.database.mysql,borland.public.delphi.database.sqlservers,comp.databases.ms-sqlserver,mailing.database.myodbc
Subject: SQL-calls to 2 databases
From: psh@nst.com (Peder)
Organization: NST
User-Agent: Xnews/2.11.08
Followup-To: mailing.database.mysql,borland.public.delphi.database.sqlservers
Lines: 53
Message-ID: <6Ux47.373$5Z5.4872@news.get2net.dk>
Date: Mon, 16 Jul 2001 08:49:06 GMT
NNTP-Posting-Host: 129.142.144.252
X-Complaints-To: abuse@uni2.dk
X-Trace: news.get2net.dk 995273346 129.142.144.252 (Mon, 16 Jul 2001 10:49:06 MET DST)
NNTP-Posting-Date: Mon, 16 Jul 2001 10:49:06 MET DST