I think this is possible but I'm having a total brain fart as to how to
construct the query..
Table2.ticket = table1.ID
Table2 is a many to 1 relationship to table1
I need to delete all records from table1 where created
unix_timestamp(date_sub(now(), interval 3 month))
And all rows from
If the tables are InnoDB, you could temporarily set up a foreign key
relationship between the two, with the 'ON DELETE CASCADE' option.
On Tue, 2008-07-08 at 11:14 -0400, Jeff Mckeon wrote:
I think this is possible but I'm having a total brain fart as to how to
construct the query..
-Original Message-
From: Ian Simpson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2008 11:27 AM
To: Jeff Mckeon
Cc: mysql@lists.mysql.com
Subject: Re: delete query question
If the tables are InnoDB, you could temporarily set up a foreign key
relationship between the two
To: Jeff Mckeon
Cc: mysql@lists.mysql.com
Subject: Re: delete query question
If the tables are InnoDB, you could temporarily set up a foreign key
relationship between the two, with the 'ON DELETE CASCADE' option.
Nope, MyISAM...
On Tue, 2008-07-08 at 11:14 -0400, Jeff Mckeon
Jeff,
Table2.ticket = table1.ID
Table2 is a many to 1 relationship to table1
I need to delete all records from table1 where created
unix_timestamp(date_sub(now(), interval 3 month))
And all rows from table2 where Table2.ticket = Table1.ID
(of the deleted rows..)
Like this (untested)?
Thanks, that did it!
-Original Message-
From: Peter Brawley [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2008 11:57 AM
To: Jeff Mckeon
Cc: mysql@lists.mysql.com
Subject: Re: delete query question
Jeff,
Table2.ticket = table1.ID
Table2 is a many to 1 relationship
Hey all
I am stuck here (thinking wise) and need some ideas:
I have this table:
CREATE TABLE `geno_260k` (
`genotype_id` int(10) unsigned NOT NULL auto_increment,
`ident` int(10) unsigned NOT NULL,
`marker_id` int(10) unsigned NOT NULL,
`a1` tinyint(3) unsigned NOT NULL,
`a2`
HAVING count(a1)25);
(note the change in case is just my way of seeing things.. it's not
necessary that I know of)
- Original Message -
From: Olaf Stein [EMAIL PROTECTED]
To: MySql mysql@lists.mysql.com
Sent: Wednesday, September 05, 2007 9:35 AM
Subject: Delete query question
Perhaps not the most elegant way:
- Create a temporary table
- Select-insert into the temp-table
- Use the temp-table for a delete-join or a 'NOT IN'-statement or something
like that
Hey all
I am stuck here (thinking wise) and need some ideas:
reply inline
On 9/5/07, Olaf Stein [EMAIL PROTECTED] wrote:
delete from geno_260k where ident=(select ident from geno_260k where a1=0
group by ident having count(a1)25);
When a sub query returns more than one row in a where clause, then =
should be replaced by the in .
--
Thanks
Alex
Stein [EMAIL PROTECTED]
To: MySql mysql@lists.mysql.com
Sent: Wednesday, September 05, 2007 9:35 AM
Subject: Delete query question
Hey all
I am stuck here (thinking wise) and need some ideas:
I have this table:
CREATE TABLE `geno_260k` (
`genotype_id` int(10) unsigned NOT NULL
Message -
From: Olaf Stein [EMAIL PROTECTED]
To: MySql mysql@lists.mysql.com
Sent: Wednesday, September 05, 2007 9:35 AM
Subject: Delete query question
Hey all
I am stuck here (thinking wise) and need some ideas:
I have this table:
CREATE TABLE `geno_260k` (
`genotype_id` int
things.. it's not
necessary that I know of)
- Original Message -
From: Olaf Stein [EMAIL PROTECTED]
To: MySql mysql@lists.mysql.com
Sent: Wednesday, September 05, 2007 9:35 AM
Subject: Delete query question
Hey all
I am stuck here (thinking wise) and need some ideas:
I have
Hope somebody can help me on this one
At present I have two tables in my database. The data in question is built
around credit card transactions.
Tables Structure
Headers Table
ID (Primary Key used by the TRANSACTIONID field in the Transaction table)
HEADERDETAILS blah, blah
Transaction
Edwards,
Friday, February 22, 2002, 12:58:23 PM, you wrote:
Eeoen Hope somebody can help me on this one
Eeoen At present I have two tables in my database. The data in question is built
Eeoen around credit card transactions.
Eeoen Tables Structure
Eeoen Headers Table
Eeoen ID (Primary
15 matches
Mail list logo