I think you should use this statement. I did not try it.
DELETE FROM hinvoice h
USING dinvoice d
WHERE h.nof=d.nof
AND h.tgl < '2002-09-01';
Regards
Stephan
-----Original Message-----
From: MySQL [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 13, 2002 9:25 AM
To: List
Subject: deleting data from mater-detail table
dear all,
hi, i have a question that bother me in last few days and would you help me
to solve it, please. i have a master-detail table: hinvoice and dinvoice.
the table structure of those two table shown as below :
create table hinvoice (
nof varchar(7) not null,
noso varchar(7),
tgl date,
amountpaid double(16,2),
status char(2),
primary key(nof)
)
create table dinvoice (
nof varchar(7),
code varchar(7),
qty int,
)
field "nof" is the join field. i intended to delete some invoices for
certain date, for example every invoice that older than 1st Sept 2002. can i
give a single query to finish this job? i can select this with
$ select h.nof, h.tgl, d.code, d.qty from hinvoice h, dinvoice d where
h.nof=d.nof where h.tgl < '2002-09-01';
query. but how can i delete them ?
thank you for your attention ..
yours,
toni
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php