RE: delete query question

2008-07-08 Thread Jeff Mckeon
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 = t

Re: delete query question

2008-07-08 Thread Peter Brawley
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)? DELE

RE: delete query question

2008-07-08 Thread Ian Simpson
> 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, with the 'ON D

RE: delete query question

2008-07-08 Thread Jeff Mckeon
> -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 ke

Re: delete query question

2008-07-08 Thread Ian Simpson
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.. > > Tabl

delete query question

2008-07-08 Thread Jeff Mckeon
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 table

Re: Delete query question

2007-09-05 Thread Baron Schwartz
; (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" Sent: Wednesday, September 05, 2007 9:35 AM Subject: Delete query question Hey

Re: Delete query question

2007-09-05 Thread Olaf Stein
at you're deleting first.. then if that is good. do >>> >>> >>> DELETE FROM geno_260k WHERE ident IN (SELECT ident FROM geno_260k WHERE >>> a1=0 >>> GROUP BY ident HAVING count(a1)>25); >>> >>> (note the change in case

Re: Delete query question

2007-09-05 Thread Olaf Stein
things.. it's not > necessary that I know of) > > > - Original Message - > From: "Olaf Stein" <[EMAIL PROTECTED]> > To: "MySql" > Sent: Wednesday, September 05, 2007 9:35 AM > Subject: Delete query question > > >> Hey all

Re: Delete query question

2007-09-05 Thread Alex Arul Lurthu
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" . -- Th

AW: Delete query question

2007-09-05 Thread it
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: I

Re: Delete query question

2007-09-05 Thread Justin
GROUP BY ident 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" Sent: Wednesday, September 05, 2007 9:35 AM Su

Delete query question

2007-09-05 Thread Olaf Stein
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` tinyint(3

Delete Query Question

2002-02-22 Thread Victoria Reznichenko
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 (Prima

Delete Query Question

2002-02-22 Thread Edwards, Peter
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