RE: upgrading mysql

2010-01-12 Thread Joshua Gordon
Also see http://dev.mysql.con/doc/refman/5.0/en/mysql-upgrade.html. And make sure you make a backup before you do anything :) -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Tuesday, January 12, 2010 10:47 AM To: Lawrence Sorrillo; mysql@lists.mysql.com Subject: Re: up

FW: cache-panel DB issue

2009-09-15 Thread Joshua Gordon
| ref | panelid | panelid | 5 | panel.t0.panelId | 1 | Using where; Using index; Distinct | ++-+---+---+---+-+-+ --+++ Thanks Joshua Gordon

Tools on http://www.severalnines.com do not work.

2009-06-16 Thread Joshua Gordon
denied. I am running this with NDB 7.0.6 and the owner of the library is mysql.mysql. Any ideas? Thanks Joshua Gordon.

binlog questions

2009-06-02 Thread Joshua Gordon
We outputted the bin log using the following command: mysqlbinlog -v --base64-output=DECODE-ROWS oo-mysql1-bin.87 We then looked in this file and found some odd things. For example there is the below insert statement: ### INSERT INTO panel.history ### SET ### @1=-182667600 (4112299696) ##

RE: Sun bought by Oracle

2009-04-21 Thread Joshua Gordon
I hope I start getting paid what Oracle DBA's make. -Original Message- From: Arthur Fuller [mailto:fuller.art...@gmail.com] Sent: Tuesday, April 21, 2009 12:04 PM To: russbucket Cc: mysql@lists.mysql.com Subject: Re: Sun bought by Oracle I too am a big entusiast of Sun's VirtualBox, and

RE: Question!

2009-03-30 Thread Joshua Gordon
Read the online Manual. -Original Message- From: Jarikre Efemena [mailto:jefem...@yahoo.com] Sent: Monday, March 30, 2009 11:30 PM To: mysql@lists.mysql.com Subject: Question! Dear sir,   I am young web developer using PHP Script in designing interactive website. I desire to include Mys

used command isn not allowed

2007-06-19 Thread Gordon
I tried running this load data command on Server version: 5.0.27 and get the 1148 error. I'm not sure if it is referring tho the comand client or the server. I also do not understand why the command {or which part} it is complaining about. Probably something obvious, but I just can't see it. A

RE: Order By and Ignore Punctuation

2007-05-04 Thread Gordon
Try something like this. If there are multiple punctuation values you want to ignore you can nest multiple REPLACE functions. mysql> create table names (name varchar(20)); Query OK, 0 rows affected (0.01 sec) mysql> insert into names values ('Osbourn'),("O'shea"),("O'Malley"),('Olathe'),('Ottawa

RE: Giving Back...Well, Maybe

2007-04-29 Thread Gordon
Just one suggestion re the behavior of special characters between file input and command line input. Try using char(10) {I think that is new line} instead of \n. That should work in both scenerios. -Original Message- From: John Kebbel [mailto:[EMAIL PROTECTED] Sent: Saturday, April 28, 20

RE: ORDER BY question

2007-03-21 Thread Gordon
I think you can also do SELECT *, DATE_FORMAT(deadline, '%d-%m-%Y') AS deadline_f, Status + 0 AS sorted_grade FROM v_issue_project_task ORDER BY sorted_grade That way you do not have to change the code if you add a value t

RE: Baffled by error

2006-05-16 Thread Gordon
Try this SELECT c.account_id, a.name,a.company, SUM(c.agent_product_time) AS mins FROM account a LEFT JOIN calls c ON c.account_id = a.id WHERE c.calldate >= DATE_SUB(NOW(),INTERVAL 14 DAY) AND c.agent_id = 9 GROUP BY a.account_id HAVING SUM(c.agent_pr

Re: Multiple primary keys

2006-04-27 Thread Gordon
MySQL will not use the primary key unless you use the left most columns. For a 1 column primary key then it's easy. For a 2 column primary key you can either use the 1st column in the primary key or both columns. If you only reference the 2nd column the query will not use the primary key and wil

RE: FW: New to TRIGGER and CALL. Example gives errors. (repost)

2006-04-12 Thread Gordon
REMOVE the semicolon ";" from " END;//" SQLyog has a problem with all of the procedures, functions and triggers RE the DELIMITER syntax. > -Original Message- > From: Daevid Vincent [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 11, 2006 10:00 PM > To: mysql@lists.mysql.com > Cc: 'Shawn

RE: Reserevd Error -7776 -- Urgent

2006-04-07 Thread Gordon
I have been linking MySQL tables into access for versions 3.23 thorough 5.17. The only way I have been able to deal with insert/update tables with a timestamp field is to build a query which includes all of the fields except the timestamp field. You can then do your insert or update against the que

RE: Stored procedures and views

2006-03-24 Thread Gordon
If the features available in stored procedures {i.e. looping etc.} are required, have you tried having the procedure 1st write/edit the data in a temporary table and at the end select the values you want from that table. I think I might write 2 procedures. One that does the data manipulation an

InnDB disabbled on 5.1.7

2006-03-24 Thread Gordon
We are running 2.6.15-gentoo Linux and downloaded the max binaries for 5.1.7. With the following my.cnf I thought we should have InnoDB. All of the InnoDB files got created but show variables like 'have%'; displays " have_innodb DISABLED". Exactly the same my.cnf {except the skip bdb is not commen

RE: Easy regex replace?

2006-03-20 Thread Gordon
If "%20" are the actual characters in the varchar column you shuld be able to do UPDATE table SETcolumn_name =REPLACE(column_name,'%20',' '); You might have to use REPLACE(column_name,'\%20',' '); to force MySQL to treat "%" as an actual value instead of a wild card. -Original Message-

RE: Some queries use 100% CPU after restore

2006-03-17 Thread Gordon
Have you tried Repair table or if InnoDB ALTER TABLE ENGINE=InnoDB; Sometimes I've noticed after a restore or after adding lots of rows performance is slow. REPAIR or the ALTER TABLE fixes it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 17,

RE: getting table metadata

2006-03-17 Thread Gordon
What you are looking for is the INFORMATION_SCHEMA views, but they are not available before 5.0. Until then you have to parse the "show create table" or "DESCRIBE tablename" may be easier to parse mysql> describe organizations; +---+

RE: Accountability with MySQL

2006-03-16 Thread Gordon
And now we are down to reality. This is a MySQL list. Views are a wonderful thing for creating an isolation layer between the application and the database. However, MySQL's current implementation makes it extremely difficult in many cases to avoid full table scans when you define the logical view.

RE: replication

2006-03-03 Thread Gordon Bruce
There is one issue. MySQL changed the way it parsed SQL join statements in 5.03. Specifically JOINS in the older syntax using implicit joins {tables seperated by ","} i.e. FROM table_a, table_b are parsed differently than they are in versions prior to 5.03. If you have any statements that do any

RE: MYSQL: Unlimited Forums, Scalablity Issues, advice please? - Bayesian Filter detected spam

2006-02-28 Thread Gordon Bruce
Let's try to characterize the load and sizing. If the posts are mostly text. 100 forums X 100,000 posts X 2,000 bytes per post = 20GB large but not huge We have people reading the posts. Even speed readers will take minutes to read the new posts. Maybe 1 in 10 - 100 readers will do a new post. A p

RE: [SPAM] - Re: Inner join with left join - Bayesian Filter detected spam

2006-02-22 Thread Gordon Bruce
If you want to see all of the products {even those that have never been ordered} then you need to SELECT ... FROM products ... LEFT JOIN orders I think you also have to do a LEFT JOIN on order_items And pull prod_name from products {don't know what the column name in products is}. SELECT o.id,

RE: Byte Swapping (Re Post)

2006-02-14 Thread Gordon Bruce
If the order of the bytes is opposite between big-endian and little-endian, then if you can get the bytes in a string REVERSE() should flip the order. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 14, 2006 3:25 PM To: gerald_clark Cc: mysql@l

RE: [SPAM] - Trans.: Re: Finding the row number satisfying a conditon in a result set - Bayesian Filter detected spam

2006-01-30 Thread Gordon Bruce
You can use a user variable [EMAIL PROTECTED] in the sample below} to number the rows in the result set. mysql> set @row:=0; Query OK, 0 rows affected (0.00 sec) mysql> select @row:[EMAIL PROTECTED], city_Name from citiesw limit 10; +--+-+ | @row:[EMAIL PROTECTED] |

RE: [SPAM] - convert help - Bayesian Filter detected spam

2006-01-19 Thread Gordon Bruce
I just added a user variable @fdata to get visabilility outside of the procedure and this is what I get. mysql> delimiter // mysql> create procedure test20 () ->BEGIN -> DECLARE fdata BLOB; -> DECLARE foffset INT UNSIGNED; -> DECLARE flength INT UNSIGNED;

RE: Show Description options??

2006-01-19 Thread Gordon Bruce
If you are on 5.0.x you can use SELECT column_Name FROM INFORMATION_SCHEMA.columns; INFORMATION_SCHEMA is a set of VIEWS that lets you access the database structure. See http://dev.mysql.com/doc/refman/5.0/en/information-schema.html -Original Message- From: Mike OK [mailto:[EMAIL

is UNION allowed in a MySQL stored procedure?

2006-01-19 Thread Gordon Bruce
I have a simple stored procedure which works as intended. As soon as I add a UNION in the SELECT I get the error message ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select phon_Lvl INTO

RE: [SPAM] - Adding data from one table to another - Bayesian Filter detected spam

2006-01-11 Thread Gordon Bruce
You probably want a multi table update assuming you are running at least 4.0.x. Add the column(s) to A with an ALTER TABLE UPDATE A INNER JOIN B ON (... SETA.col_name = B.col_name, A.col_name_2 = B.col WHERE .. You can copy the join structure from the FR

RE: [SPAM] - Re: mysql 5 - disk bound - fixed - Email found in subject

2006-01-11 Thread Gordon Bruce
One huge problem with this approach. The new table doesn't have any of the indexes that were present in the previous table. You may be better off to build a script that renames the current tables followed with the full CREATE TABLE statement(s). Do a SHOW CREATE TABLE current table; Then take tha

RE: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Gordon Bruce
Actually CONV converts from any base to any base so if it is base 10 then just replace the 16's with 10's. Too much time looking at dump's. -Original Message- From: Bill Dodson [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 10, 2006 3:09 PM To: Gordon Bruce Cc:

RE: Converting decimal to binary

2006-01-10 Thread Gordon Bruce
If by Decimal you mesn HEXIDECIMAL you can use CONV where the 1st arg is the HEX value, 2nd arg is From Base and 3rd arg is To Base. You will have to suround the aliases with "`'s" if you really want the names to be numeric. mysql> select MID(CONV('A5',16,2),1,1) AS `7`, ->MID(C

RE: [SPAM] - concat string and update question - Found word(s) remove list in the Text body

2006-01-09 Thread Gordon Bruce
Try this UPDATE people SETphone = CASE WHEN LEFT(phone,4) = '405_' THEN MID(phone,5,20) WHEN LEFT(phone,3) = '405' THEN MID(phone,4,20) ELSE phone END FROM people WHERE LEFT(phone,3) = '405' AND LENGTH(phone) >

FW: Re: SQL Question

2006-01-06 Thread Gordon Bruce
Why not just use the ABS Function update ev98nv_tm set mome=ABS(b) where tm.tr=tr and tm.ra=ra and tm.ke=ke and tm.moti=moti ; 12.4.2. Mathematical Functions All mathematical functions return NULL in the event of an error. ABS(X) Returns the absolute value of X. m

RE: [SPAM] - Re: SQL Question - Bayesian Filter detected spam

2006-01-06 Thread Gordon Bruce
Why not just use the ABS Function update ev98nv_tm set mome=ABS(b) where tm.tr=tr and tm.ra=ra and tm.ke=ke and tm.moti=moti ; 12.4.2. Mathematical Functions All mathematical functions return NULL in the event of an error. ABS(X) Returns the absolute value of X. m

RE: Can this SELECT go any faster?

2006-01-04 Thread Gordon Bruce
Try this SELECT replace(left(history.time_sec,7),'-','') AS month FROM history WHERE history.account_id = 216 GROUP BY month ORDER BY history.time_sec DESC; This is what I get on 1 of my tables with no index on perm_user_ID , 80,000 rows in the table and 7,000 rows where perm_user_ID = '

RE: Changing types on the fly in select queries?

2005-12-27 Thread Gordon Bruce
Generally MySQL does format conversion for you to match data types. You can also force the CONCAT result to be integer by the following where concat(year,period,week) + 0 < 2007031 ^^^ -Original Message- From: Jay Paulson (CE CEN) [mailto:[EMAIL PROTECTED]

Is this a MySQL 5.0.x bug OR What am I missing?

2005-12-23 Thread Gordon Bruce
er_Create | +-+-+-+-+--+--+---+----+++-+--+-

RE: [SPAM] - Re: locating ibdata1 and *.ibd files in different directories. - Bayesian Filter detected spam

2005-12-20 Thread Gordon Bruce
The following takes a little effort, but it should get you close to dump file size. On 5.0.x you can use Information_schema.columns to get average row length for MyISAM tables. Take that plus the punctutation {~35 + 3* # cols for insert per row if you enclose your columns in "'s} in the insert sta

RE: copying data!!!

2005-12-09 Thread Gordon Bruce
Sorry the DROP TABLE Should be TEMP not table1 -Original Message- From: Gordon Bruce [mailto:[EMAIL PROTECTED] Sent: Friday, December 09, 2005 3:51 PM To: Sachin Bhugra; mysql@lists.mysql.com Cc: [EMAIL PROTECTED] Subject: RE: copying data!!! This is kind of ugly, but with the

RE: copying data!!!

2005-12-09 Thread Gordon Bruce
This is kind of ugly, but with the multitable limitations of 3.23 it probably works. CREATE TABLE TEMP SELECT table_1 columns except age, table_2 age FROM table_1 INNER JOIN table_2 USING (name); TRUNCATE table_1; INSERT INTO table_1 SELECT * FROM TEMP; DROP TABLE_1; --

RE: Format for saving date field.

2005-11-10 Thread Gordon Bruce
What is the source of the data that is displayed on the screen. If it is a field in a MySQL table and the data type for that field is either DATE or DATETIME then it will intsert/update without any manipulation. Try doing a SELECT datefield FROM table Limit 15; outside of your ASP.NET envi

RE: Query producing default values

2005-11-09 Thread Gordon Bruce
Try this {I wasn't sure whether cd_nature_ltr is in ligne_trans or transaction. This assumes ligne_trans. If it is in transaction thatn move "cd_nature_ltrsn = 2" into the ON clause.} SELECT CASE id_ltrsn WHEN NULL THEN 0 ELSE id_ltsrn END AS id_ltrsn, CASE

RE: Help optimize this simple find

2005-11-07 Thread Gordon Bruce
Is it possible to change the geocodes table to look like CREATE TABLE `geocodes` ( `ip` int(10) unsigned zerofill NOT NULL default '00', `lat` double default NULL, `lon` double default NULL, PRIMARY KEY (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Then you could do SELE

RE: SQL Statement Conversion

2005-11-04 Thread Gordon Bruce
If your MySQL server is a *nix system than table names are case sensitive. SELECT A.*, CASE CounselorOnly WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' END AS CO FROM Activities A ORDER BY Activity I also just noticed, remove the "CO =" and add "AS CO" following the END

Sub Selects, Alias Names and stored procedures

2005-11-04 Thread Gordon Bruce
After reading one of the recent posts from Gobi [EMAIL PROTECTED] I took his successful query and modified it for one of my tables. It indeed produce the correct result, but in the process raised some questions. 1. Why do list_ID and acct_ID not have to be qualified with a table name or

RE: [SPAM] - Query help - Bayesian Filter detected spam

2005-10-11 Thread Gordon Bruce
You might try UNION with the 1st statement pulling all products with groupid = 0 and the 2nd pulling 1 product with groupid > 1. -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, October 10, 2005 3:31 PM To: MySQL List Subject: [SPAM] - Query help - Bayesian Fil

RE: how to list foreign keys

2005-10-05 Thread Gordon Bruce
IF you are on 5.0.x you can use INFORMATION_SCHEMA 21.1.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table http://dev.mysql.com/doc/mysql/en/key-column-usage-table.html -Original Message- From: Operator [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 05, 2005 3:02 PM To: mysq

RE: strange order by problem

2005-09-27 Thread Gordon Bruce
Try this mysql> select distinct secname, date -> from optresult -> where secname like 'swap%' ->and date like '2005-09-2%' -> order by if(secname like 'swap%', -> (mid(secname,5,20)+0), -> secname); +--++ | secname | d

RE: insert subquery

2005-09-23 Thread Gordon Bruce
What am I missing INSERT INTO table1 (column names.) SELECT VALUES.. FROM table2 WHERE primary id = insert value You will have to put in your real table name and column names. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 23, 200

RE: Union vs OR

2005-08-26 Thread Gordon Bruce
It's getting late on Friday, but couldn't you build a table with all of the parameter combinations and then just join against that table? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 4:25 PM To: mysql@lists.mysql.com Subject: Union vs

RE: Compare two tables

2005-08-26 Thread Gordon Bruce
If you have the 5.0.x version of MySQL then INFROMATION SCHEMA can give you what you want. i.e. SELECT a.*, b.* FROM INFORMATION_SCHEMA.COLUMNS AS a INNER JOIN _SCHEMA.COLUMNS AS b ON (a.column_name = b.column_name) WHERE a.TABLE_NAME = 'foo_1' AND b.TABLE_NAME = 'foo

RE: Treating Two Fields Like One

2005-08-24 Thread Gordon Bruce
I think you misunderstand how auto_increment works. Primary keys using auto_increment are NOT row numbers. If your table has a primary key that is an auto_increment field then when you add a row to the table the value of the primary key of the new row is 1 greater than the max(Value) before the ro

RE: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Gordon Bruce
Do You know about INTERVAL? Use it in an exprecssion or funtion as ..INTERVAL expr type where expr is any numerical value * The INTERVAL keyword and the type specifier are not case sensitive. The following table shows how the type a

RE: SELECT ... INTO OUTFILE ... and LOAD DATA INFILE ... with a key

2005-08-19 Thread Gordon Bruce
If you want to have all values except the primary key be the same and say your is foo_ID You can simply do INSERT INTO foo (foo_ID... {rest of columns list}) SELECT new primary key value, {rest of columns list} FROM foo WHERE foo_ID = {primary key value of row you want to copy} If

RE: query

2005-08-16 Thread Gordon Bruce
You can use INTERVAL i.e. Lets say you have a table mysql> CREATE TABLE foo (bar int(14), fdate date ); Query OK, 0 rows affected (0.27 sec) mysql> INSERT INTO foo > VALUES (1, now()), (25,now() - INTERVAL 1 DAY), (15,now() - INTERVAL 2 DAY); mysql> SELECT f1.

RE: Index - max key length is 1024 bytes

2005-08-12 Thread Gordon Bruce
If you are on a version prior to 4.1.2 the max index size is 500 bytes {not sure why the error mentions 1024} >From section 14.1 of documention The maximum key length is 1000 bytes (500 before MySQL 4.1.2). This can be changed by recompiling. For the case of a key longer than 250 bytes, a larger

RE: JOIN QUERY -> UPDATE ... help?!

2005-08-09 Thread Gordon Bruce
Multi Table UPDATES are first supported in 4.0.x -Original Message- From: Brendan Gogarty [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 09, 2005 12:16 PM To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: RE: JOIN QUERY -> UPDATE ... help?! "Brendan Gogarty" <[EMAIL PROTECTED]>

RE: top one row

2005-08-05 Thread Gordon Bruce
This is out of the MySQL class and is called the Max-Concat trick. What is the biggest country in each continent? "The Rows Holding the Group-wise Maximum of a Certain Field" MySQL> Select Continent, -> SUBSTRING(M

Number of SQL Queries curiosity

2005-08-05 Thread Gordon Bruce
We have a relatively small web site running 4.0.20 on a Dell 2850 running RedHat. We rarely see any SQL statements visible when we run SHOW PROCESSLIST and typically use 30 - 40 concurrent connections. The Number of SQL Queries graph in MySQL Administrator usually is in the 0 to 10 range wit

RE: advanced group by

2005-08-03 Thread Gordon Bruce
Something like this SELECT CompanyName, WhatToShip, SUM(IF(TrackingNumber = '', IF(SerialNumber = '', 1, 0), 0) ) AS READY, SUM(IF(TrackingNumber <> '', IF(SerialNumber = '',

RE: Renaming a database

2005-07-18 Thread Gordon Bruce
A database in MySQL is simply a directory.   So just rename the directory with appropriate tool for your platform. On my test box this becomes   mysql> show databases; ++ | Database   | ++ | information_schema | | lois 

RE: Impossible join?

2005-07-18 Thread Gordon Bruce
Here is one way. Some time ago I set up a table named count with one field named count and built 5000 rows of incrementing values . I think I originally populated it by originally createing it with a 2nd field CREATE TABLE `count` ( `count` int(10) unsigned NOT NULL auto_increment, `add

RE: Count(*)

2005-07-07 Thread Gordon Bruce
select count(distinct ordr_ID) from store -Original Message- From: Gana [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 3:01 PM To: mysql@lists.mysql.com Subject: Count(*) select count(*) from store group by orederId. For the above sql, I am not getting the count of unique orde

RE: question about field length for integer

2005-06-27 Thread Gordon Bruce
If you really need more than 20 digits of accuracy and can move to 5.0.3 + you can use the Decimal data type without losing precision. This is out of Chapter 23. Precision Math The maximum value of 64 for M means that calculations on DECIMAL values are accurate up to 64 digits. This limit of 64

RE: Intersting MySQL / Access Issue

2005-06-22 Thread Gordon Bruce
When I have seen this error it was caused by a field defined in the MySQL database as NOT NULL in the Create table and the value in Access is NULL or usually for us an empty field in EXCEL which is appears to be intreped as NULL when you do a PASTE APPEND. Ours is often times a datetime field but

RE: Backup database with MyISAM and InnoDB tables together

2005-06-17 Thread Gordon Bruce
M > tables? > > WOuld I be better off locking the database from any updates/inserts, and > > specifying particular commands for individual tables? > > Any advice appreciated, including RTFMs with links. > > > Gordon Bruce wrote: > If you are runing binary log

RE: Backup database with MyISAM and InnoDB tables together

2005-06-17 Thread Gordon Bruce
If you are runing binary log and do a FLUSH LOGS mysqldump --opt --skip-lock-tables MyISAM table names FLUSH LOGS mysqldump --opt --single-transaction INNODB table names You have a recoverable state with the combination of the mysqldump file and the binary log file that was started by the 1st

RE: alter only an enum label

2005-06-16 Thread Gordon Bruce
perience on how long it will take with milions of records? all records havin only a int(11) as unique key and the enum field.. suposing now i have enum("a", "b") only, and did a "ALTER TABLE tablename CHANGE columnname columnname ENUM('a','b','c&#x

RE: alter only an enum label

2005-06-16 Thread Gordon Bruce
If you have "c" values in the table currently you can just do an ALTER TABLE tablename CHANGE columnname columnname ENUM('a','b','c','x') DEFAULT "a" NOT NULL then UPDATE tablename SET columname = 'x' WHERE columname = 'c' Then ALTER TABLE tablename CHANGE columnname columnname ENUM('a','b',

RE: discuss: user management

2005-06-14 Thread Gordon Bruce
It always helpd me to change MySQL's "user" to connection in my head when I begin to think about access control. Then in most database designs that I have seen, row access control is just as important as database/table/column. Then the question becomes does the "user" have direct access to the data

RE: Foreign key constraint problem

2005-06-14 Thread Gordon Bruce
In some hierarchies I have seen people put the the current id in the parent_ID Field {basicaly pointing to them self} to represent the top of the hierarchy. I don't know how much this would affect the rest of your application but it would get rid of the null's -Original Message- From: Ma

RE: CREATE TABLE and specifying DEFAULT

2005-06-13 Thread Gordon Bruce
I just ran the creates on 4.0.20 on LINUX and 5.0.6 on Windows and they both seem to look fine {see the SHOW CREATE TABLE's following the CREATE TABLE statements} RUN ON 4.0.20 mysql> CREATE TABLE ID ( -> mat INT UNIQUE PRIMARY KEY, -> ID_firstname CHAR(35) DEFAULT 'filler', -

RE: How to control database size in MySQL Windows?

2005-06-10 Thread Gordon Bruce
If you are on 5.0.n there is an INFORMATION_SCHEMA which you can query like this. A casual scan of the mysql tables don't show any sizes and I don't know of a way to get table/database size via SQL. mysql> select table_schema, sum(DATA_LENGTH) from information_schema.tables group by 1; +--

RE: Seriously.. When are we going to get subqueries?!

2005-06-09 Thread Gordon Bruce
You can have any number of timestamp columns, but only one of them can be set to autoupdate. As of 4.1 you are not limited to this being the 1st one in the table and CURRENT_TIMESTAMP, CURRENT_TIMESTAMP(), or NOW() can be used in the DEFAULT. Read http://dev.mysql.com/doc/mysql/en/timestamp-4-1.

RE: Are partial searches possible?

2005-06-08 Thread Gordon Bruce
You can try if($queryID = mysql_query("SELECT * FROM WhInventory WHERE Booking like ('%15%') ORDER BY Booking",$dbLink)) -Original Message- From: Don [mailto:[EMAIL PROTECTED] Sent: Wednesday, June

RE: Mysqldump

2005-06-02 Thread Gordon
If you just dump the structure with mysqldump and then build SELECT INTO OUTFILE and LOAD DATA INFILE statements for each table, the process will run faster than even the "extended insert" option of mysqldump. -Original Message- From: ManojW [mailto:[EMAIL PROTECTED] Se

RE: Database design query

2005-05-31 Thread Gordon
IF GroupID, HostID and UserID are unique between the three sets then your GroupMember table will work although I would still be tempted to add a MemberType in the GroupMember table. Isn't MemberID the Foreign Key to UserID/HostID/GroupID althugh I don't know if you can have three different foreig

RE: LOAD DATA and skip columns in text file...

2005-05-25 Thread Gordon
The folowing is out of the current MySQL manual. It looks like you could create an intermediate table with the fields you are interested in the front and "garbage" fields on the end. Then build a specific LOAD DATA INFILE with correct mapping for each file type [assuming you can tell this in your a

RE: DB design question

2005-05-24 Thread Gordon
You probably want to add type to both the address and phone tables. Then you can be selective in your reporting and still get 1 row per student in your result set. Just remember if your data has the possibility of not having the information for a student you want to use LEFT JOIN's vs INNER JOIN's

RE: varchar(10) to decimal

2005-05-18 Thread Gordon
I was all set to tell you why 16.125 became 16.12 when I ran the test on our production box. It looks like some where between 4.0.20 and 5.0.4 the ALTER TABLE to a decimal data type changed from truncation to rounding. Redhat MySQL 4.0.20 truncates all Windows XP MySQL 5.0.4 Rounds with Windows a

RE: Read past Equivalent in MySQL

2005-05-13 Thread Gordon
If you can add a table structure why not create a SELECTED table with REPORT ID and PERSON ID as the 2 field PRIMARY KEY. Then you could INSERT IGNORE into this table [with no BEGN/COMMIT] and the IGNORE would throw away those already selected. -Original Message- From: Duncan Hill [mailto

RE: ACCESS ODBC Interface whit 5.0.4

2005-05-05 Thread Gordon
> Has anyone else seen this or have any ideas? > "Gordon" <[EMAIL PROTECTED]> wrote: -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __

RE: ACCESS ODBC Interface whit 5.0.4

2005-05-05 Thread Gordon
(14) NOT NULL, `poch_Create` datetime NOT NULL default '-00-00 00:00:00', PRIMARY KEY (`cpny_ID`,`prod_ID`,`porc_Look_Up_Type`,`prft_Sub_Month`,`prft_Sub_Item`,`p och_Name`) ) TYPE=InnoDB | ---+ 1 row in set (0.00 sec) mysql> -Original Message---

ACCESS ODBC Interface whit 5.0.4

2005-05-04 Thread Gordon
I have been using ACCESS to do simpe data editing on our MySQL tables for 3 years. I recently installed 5.0.4 on my machine to evaluate it. I linked the tables into ACCESS through my old ODBC driver and got ODBC-update on a linked table 'product_order_choice' failed [Microsoft][ODBC Driv

RE: Help with a tricky/impossible query...

2005-04-14 Thread Gordon
One way would be to build a "count" table with one column starting with value 1 and incrementing by 1 up to say 500 rows or how many your max y value is. Then just select seq,val from wibble,count where val between x and y create table count (val INT unsigned default '0' not null primary key)

RE: design: table depending on a column

2005-04-12 Thread Gordon
As long as articles.annotationID can be made distinct from names.annotationID why not use 2 left joins. You may have to test annotationType in the select section to map the fields. Something like the following. SELECT elements.annotationID, CASE annotationType WHEN 'names' T

RE: Trouble performing an update

2005-03-16 Thread Gordon
You can do left joins in an update. mysql> show create table t; +---+--- -- | Table | Create Table +---+--- -- | t | CREATE TABLE `t` ( `key1` int(1

RE: Slow queries only the first time

2005-03-10 Thread Gordon
The key to your question is InnoDB. InnoDB keeps data and indexes in its buffer using LRU to flush. So the 2nd time your data was already in memory. Depending on your buffer size and database size you have all of the advantages of a memory resident database for frequently used data without the dis

RE: Use MySQL with Microsoft Office

2005-03-08 Thread Gordon
If Publisher XP's mail merge can find data in ACCESS try linking the tables into an ACCESS database and then tying Publisher to the ACCESS database. Sounds klunky but it might work. -Original Message- From: GH [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 9:37 AM To: J.R. Bulli

RE: select date_format('2004-10-03 15:06:14','%m/%d/%y %T');

2005-03-08 Thread Gordon
I have > 200 tables with regular datetime fields. I link these tables through ODBC to an ACCESS database where I can run standard ACCESS append queries or even copy/paste append into the linked table. ODBC handles the conversion just fine. One caution, MySQL timestamp maps to ACCESS datetime but

RE: Odd rounding errors with 4.1

2005-02-23 Thread Gordon
This reminded me of one more difference between Windows and Linux/Unix. MySQL use the round function out of the host libraries. If you are on a Windows box the rule for rounding is if the column immediately to the right of the column you are rounding to is a 5 then round up i.e. make 2.485 >>>

RE: how to write this query?

2005-02-21 Thread Gordon
This works if you don't care about holidays. If you do the only solution that I have seen that works is to create a business day table. Ours is shown below. You have to hand construct the calendar by removing weekends and holidays for the specific entity. This calendar forces a non business day DA

RE: Query problem

2005-02-18 Thread Gordon
Did you want WHERE Name LIKE 'sandy' OR (main_data.Display_In_Search = 1 AND main_data.Expiry_Date >= CurDate()) OR WHERE main_data.Expiry_Date >= CurDate() AND (Name LIKE 'sandy' OR main_data.Display_In_Search = 1 ) -Original Message

RE: select where multiple joined records match

2005-02-14 Thread Gordon
Try this Select * from resources, goals where resources.ID = goals.RESOURCE_ID and (SUBJECT="English" and GRADE="1") OR (SUBJECT="English" and GRADE="2"); -Original Message- From: AM Thomas [mailto:[EMAIL PROTECTED] Sent: Sunda

RE: Syntax Failures with SELECT SUBSTRING - Help!

2005-02-03 Thread Gordon
Try SELECT SUBSTRING(AnimalName, 1, 1) MySQL wants the "(" to immediately follow the function i.e. no spaces. -Original Message- From: Sue Cram [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 9:28 AM To: mysql@lists.mysql.com Subject: Syntax Failures with SELECT SUBSTRING - H

RE: How to select every second record

2005-01-27 Thread Gordon
Try this. The second set ... select gives you what you want. However, the group by may interfere with the rest of your logic. You also don't really need the mod(@a,2) in the result set, just in the having. mysql> set @a:=0; Query OK, 0 rows affected (0.00 sec) mysql> select @a:[EMAIL PROTECTED],m

RE: Yet another LEFT JOIN question

2004-12-06 Thread Gordon
Try something like this SELECT A1.ID, SUM(IF(ISNULL(C.AdID),0,1)) AS Clicks, SUM(IF(ISNULL(V.AdID),0,1)) AS Views FROM Ads A1 LEFT JOIN Clicks C ON A1.ID = C.AdID LEFT JOIN Views V ON A1.ID = V.AdID GROUP BY A1.ID -Original Message- From:

RE: matching people with projects via resources

2004-10-01 Thread Gordon
This may not be elegant, but why not define a 3rd table proj_c containing proj and project_rsrc. This assumes that when you define a project you know how many resources are required. CREATE TABLE proj_c ( proj varchar(11) default NULL, project_rsrc INT default 0); INSERT INTO proj_c VALU

RE: weird kind of join

2004-09-29 Thread Gordon
You might also try FROM table_a INNER JOIN table_b ON table_b.code = substring_index(table_a.code,';',1) SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final deli

  1   2   >