[PLUG] MySQL Statement?

Steven D. Coffman s.coffman at tradetrans.net
Thu Jul 28 17:41:12 UTC 2005


Hi All,
Wonder if anyone could give me an example.. it's been a while since I've
done SQL commands that are more complicated:

I need to clean up our database. The tables and files are a bit
complicated but the general gist of what I need to do is like this
(sorry.. best way I can explain it is psuedo code)

Select Atable where Company = 1212 and Date < "2005-01-01"
  ** ok, this is the basic select I want from the file and I only need
the "fileID" from this table **

*** Once all of the fileID's from the above select has been performed, I
want to run a delete routine for every fileID from that first select ***
For (?? Every fileID)
  Delete tableB, Delete tableC....etc.
  Next fileID

Lol.. guess it's been a while since I've coded stuff. The only real
element that is in common for all of the tables is the fileID on the
first "Atable". I want to select all of the fileID's for that company
that meets the date requirements, then delete each table associated for
that fileID.  Hope that makes some sense. I can to the first select and
know how do perform the deletes.. I'm just missing that next step of
getting all of the selected fileID's and then read them back into the
next selection.

Thanks,
Steve

Steven D. Coffman
Director
Electronic Commerce & Business Intelligence
TradeTrans, Inc. - Intelligent Electronic Commerce 

Phone:     (503) 601-0037
E-Mail:    s.coffman at tradetrans.net
Website:  http://www.tradetrans.net 
 

-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.5.0 - Release Date: 6/2/2005
 




More information about the PLUG mailing list