You can use the LIMIT clause to break up a long DELETE into a series of shorter ones,
executed in a loop.
So, in pseudo-code:
Set delete_row_max = 1000 (or another appropriate value)
do
{
DELETE FROM outgoing
WHERE timestamp last_time
LIMIT delete_row_max;
row_count = no. of
$dbh =
DBI-connect(DBI:mysql:database=$database;host=$host,$user,$mysqlpassword,{'RaiseError'=1});
$update_number = UPDATE $table set total_clicked = total_clicked + 1;
$sth = $dbh-prepare($update_number);
if (!$sth) { die Error: . $dbh-errstr . \n; }
if (!$sth-execute) { die Error: .
SELECT f.language as From, t.language as To
FROM language f, language t, language_pairs lp
WHERE f.id = lp.from
AND t.id = lp.to;
--Greg Johnson
-Original Message-
From: Andreas Frøsting [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 10:13 AM
To: [EMAIL PROTECTED]
Subject:
SELECT Table1.orderid, Table2.otherfield1, Table2.otherfield2
FROM Table1, Table2
WHERE Table1.orderid = Table2.orderid;
--Greg Johnson
-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 12:31 PM
To: [EMAIL PROTECTED]
SELECT LAST_INSERT_ID() will return the last auto_increment key written. This value
is connection-specific, so that inserts performed on other connections will not affect
it (in other words, you'll get the last key generated by user 1, regardless of what
user 2 does in the meantime).
--Greg
cat thefilename | mysql -uuser -ppassword dbname
--Greg Johnson
-Original Message-
From: David Turner [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:13 PM
To: [EMAIL PROTECTED]
Subject: Run a file from mysql prompt
How do I get a file full of sql commands to run
from
Create two association tables:
Contributor
++--+--+-+-++
| Field | Type | Null | Key | Default | Extra
|
++--+--+-+-++
| Contributor_ID | tinyint(3) | |
SELECT REPLACE(DIRECTIONS, '#', 'No.')
FROM shpr_rcvr
WHERE etc.
-- Greg Johnson
-Original Message-
From: Richard Reina [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 31, 2001 1:23 PM
To: [EMAIL PROTECTED]
Subject: unique problem?
I have a table shpr_rcvr that stores info about
UPDATE myTable
SET DueField = 0,
StatusField = IF(StatusField = 'O', 'C', StatusField)
WHERE PrimaryKeyField = XYZXYZ;
-- Greg Johnson
-Original Message-
From: Chris Boget [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 07, 2001 1:42 PM
To: [EMAIL PROTECTED]
Subject: Can this be
SELECT SUM(d.AcctSessionTime) + IFNULL(m.Minutes, 0)
FROM detail d LEFT OUTER JOIN monthly_usage m ON d.UserName = m.UserName
WHERE d.UserName = 'foo';
Or, to summarize for all users:
SELECT d.UserName as user, SUM(d.AcctSessionTime) + IFNULL(m.Minutes, 0)
FROM detail d LEFT OUTER JOIN
If you are using the Mark Matthews JDBC driver (MM.MySQL), there's another way to get
the last insert id: instead of using a generic Statement object to execute the INSERT
command, use an org.gjt.mm.mysql.Statement object. After executing an INSERT, the
method getLastInsertID() will return
Use a join query, rather than separate single-table queries:
SELECT a.*, n.url
FROM articles a, news_sites n
WHERE a.news_site_key = n.news_site_key;
-- Greg Johnson
-Original Message-
From: Bennett Haselton [mailto:[EMAIL PROTECTED]]
It looks to me as though the tracked.window=137 condition is suppressing output of
any available rows which do not have a target match in tracked - tracked.window
would = NULL in those cases.
--Greg Johnson
-Original Message-
From: George Eric R Contr
?
-Original Message-
From: Johnson, Gregert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 03, 2001 10:03 AM
To: [EMAIL PROTECTED]
Subject: RE: Left Join problem
It looks to me as though the tracked.window
Mariacust must be included in you FROM list:
SELECT ...
FROM customers, mariacust
WHERE ...
-Original Message-
From: Armando Cerna [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 12:16 PM
To: [EMAIL
SELECT DISTINCT u.userid, IF( ul.listid, true, false)
FROM user u LEFT OUTER JOIN userlist ul ON u.userid = ul.userid
AND ul.listid = listid;
-Original Message-
From: David Otton [mailto:[EMAIL PROTECTED]]
show index from tablename;
This returns a result set listing all indexes on the table.
--Greg Johnson
-Original Message-
From: Christopher Teli [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 12:32 PM
To:
Try something like
SELECT fid, Family_Last_Name, Phone, playertable.Family_ID
FROM familytable
LEFT OUTER JOIN playertable ON playertable.Family_ID = familytable.fid
AND playertable.SportRegistered = 'O'
GROUP BY fid
ORDER BY Family_Last_Name ASC;
The rows from
SELECT l.load_no, l.date
FROM loads l
LEFT OUTER JOIN invoiced i ON l.load_no = i.load_no
WHERE l.dlvr_date 0
AND i.load_no IS NULL;
-- Greg Johnson
-Original Message-
From: Richard Reina [mailto:[EMAIL PROTECTED]]
Sent: Wednesday,
SQL Server will allow you to limit a SELECT to the first n rows, but not (to my
knowledge) to skip a number of rows before returning the desired rows.
The mechanism used is SET ROWCOUNT (6.5 and 7.0) or TOP (7.0). The difference is that
SET ROWCOUNT limits the output rows before applying an
What would really help would be to use multiple row inserts, i.e.
INSERT INTO speed1 VALUES (a,b,c),(d,e,f),(g,h,I),...
So, prepare a series of inserts, each with a few hundred (or even thousand) row value
sets.
--Greg Johnson
-Original Message-
The valid range for an 'int' data type (your "id" column) is -2147483648 to
2147483647. The value you are attempting to set (37647438380) is not within this
range.
--Greg Johnson
-Original Message-
From: Andreas Gietl [mailto:[EMAIL PROTECTED]]
23 matches
Mail list logo