Re: Problem with corrupt binary data being returned from MySQL

2002-06-13 Thread Harrison C. Fisk
The data isn't actually being corrupted. The problem here is that SELECT INTO OUTFILE wants to escape all of the line breaks as to make it easy to reimport the data using LOAD DATA INFILE. You could work around that by setting the escape character using: FIELDS ESCAPED BY ''; The total

Re: Problem with corrupt binary data being returned from MySQL

2002-06-13 Thread Harrison C. Fisk
Err, I don't know what I was thinking. You can simply do a select into dumpfile like: select data from test where id=1 into dumpfile /tmp/test2.gif; That is designed for writing blobs to a file. Harrison Harrison C. Fisk wrote: The data isn't actually being corrupted. The problem here

Re: Need Help with JOIN

2002-06-13 Thread Harrison C. Fisk
Mike, With the way you have it written below, all of the pic1_id, pic2_id, pic3_id, and pic4_id must be equal (because they all equal pic.pic_id). Since this wasn't true for any of the rows, that is why you were getting no results. To get each picture value seperately, you will have to do

Re: Subselect translation?

2002-06-11 Thread Harrison C. Fisk
I believe the following query will do what you want it to do: SELECT t1.id from table1 as t1 LEFT JOIN table2 as t2 on t2.t1id = t1.id AND t2.id = 9 WHERE t2.id IS NULL; More information can be found at http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html about sub-select work arounds.

Re: 45 seconds

2002-06-10 Thread Harrison C. Fisk
Hello, The reason that it takes so long is because you are using regexp on a function to join the table. That means that MySQL can't use indexes for that column. If you run an EXPLAIN on the query you will see that is true. To speed up the query some you could add an index on

Re: Batching sql statements

2002-05-28 Thread Harrison C. Fisk
The mysql command line client can accept batch files as: mysql -uuser -ppassword database file.sql file.sql is just a file with the plain text SQL statements in it that you want to run. Then since you are on Windows 2000, you could setup Task Scheduler to run it every night at whatever time

Re: What files are these?

2002-05-27 Thread Harrison C Fisk
These are binary update log files. They keep track of all updates to your database. They are often used when restoring from a backup and also are required for replication. You can doa FLUSH LOGS and then move away the old logs or delete them if that is what you want to do. Be sure to always

Re: Inserting images and other blobs

2002-05-21 Thread Harrison C. Fisk
There is a function called Load_File which will cause the mysqld to read the file into a field. It is designed for such things. Check out http://www.mysqldeveloper.com/faqs/index.pcgi?id=7 for more information. Keep in mind that generally it is better to use the file system to store files and

Re: my.cnf

2002-05-21 Thread Harrison C. Fisk
On UNIX and Linux machines, there are a few places that MySQL will look for your my.cnf. The are detailed at: http://www.mysql.com/doc/O/p/Option_files.html However if none of these files exist, then MySQL will use the default values assigned for all neccesary settings. You can then just create

Re: Query help

2002-05-21 Thread Harrison C. Fisk
Here is a query that will do what you want I think: SELECT count(distinct goal.id) as ours, count(distinct goalopp.id) as theirs, game.id FROM game LEFT JOIN goalopp ON game.id=goalopp.game LEFT JOIN goal ON game.id=goal.game GROUP BY game.id HAVING ours theirs; We have to use

Re: SQL query

2002-05-21 Thread Harrison C. Fisk
This seems like a fairly straight forward and simple query, however you run into the max row information problem as described in the manual at http://www.mysql.com/doc/e/x/example-Maximum-column-group-row.html Finding the first part is fairly easy and straight forward, it is just getting the

Re: Resorting entire Database

2002-05-19 Thread Harrison C. Fisk
The normal way to do it is to pipe it to the mysql command line client which will make it enter batch mode and run the .sql file. The basic syntax will look something like: mysql -p database file.sql This should work in windows or in any unix environment. This is also assuming the file is in

Re: ALTER TABLE $table ADD $value2 TEXT NUT NULL

2002-05-17 Thread Harrison C. Fisk
Hello, Try using NOT NULL. As weird as MySQL can be, don't think it is that NUTty. =) Harrison - Original Message - From: Jule [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 17, 2002 7:00 PM Subject: ALTER TABLE $table ADD $value2 TEXT NUT NULL Hey i'm getting this

Re: ALTER TABLE $table ADD $value2 TEXT NUT NULL

2002-05-17 Thread Harrison C. Fisk
Hello, Try using NOT NULL. As weird as MySQL can be, don't think it is that NUTty. =) Harrison - Original Message - From: Jule [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 17, 2002 7:00 PM Subject: ALTER TABLE $table ADD $value2 TEXT NUT NULL Hey i'm getting this

Re: Most efficient query

2002-05-09 Thread Harrison C. Fisk
You can do this with a pretty simple left join as follows: SELECT MainTable.ID from MainTable LEFT JOIN MapTable ON MainTable.ID=MapTable.ID where MapTable.ID IS NULL; Because it is a left join, it will pad all MainTable entries that don't appear in MapTable with NULL's. Hence we can check if

Re: SQL-query

2002-05-05 Thread Harrison C. Fisk
If you only want to get the Max or min of a single row, then you should try something like: SELECT date_value, version_id FROM dates WHERE version_id=2 ORDER BY date_value DESC LIMIT 1; However if there might be two of the rows with the highest you will need to use either a max-concat trick or

Re: Get the next AUTO INCREMENT value for a column

2002-05-04 Thread Harrison C. Fisk
Actually I think the SHOW TABLE STATUS like 'TABLENAME' command can show you the next auto_increment value. Although I can say I wouldn't really ever use it except for personal use, not in an actual application. Harrison - Original Message - From: Paul DuBois [EMAIL PROTECTED] To: Son

Re: Newbee: importing data from .MYD .MYI .frm

2002-05-04 Thread Harrison C. Fisk
Those are the actual table files that MySQL uses for the MyISAM table type. You should be able to just copy them into the datadir under a database directory and MySQL will find them and you should be able to use the tables like normal after copying them. If you don't know where your datadir is

Re: error during sql-bench: create-mysql-SunOS_5.8_i86pc

2002-05-04 Thread Harrison C. Fisk
On my system error 28 is no space left on device. harry@LordBlink:~ perror 28 Error code 28: No space left on device You can verify that is the same on your system with the perror command that should come with your MySQL installation. If it is the same error then make sure that your datadir