Trouble with WHERE Clause

2007-03-12 Thread Richard Kurth
I have two tables I just what the data from the 1 table that is not in the 2 table So in this example I what row formelements_id 22 and 23. I have tried different sql statements one is below SELECT customformelements.formelements_id ,dbelements.customer_id,customformelements.formelements_field_

function based index

2007-03-12 Thread Ananda Kumar
Hi All, Is it possible to create function based index in mysql as available in oracle. Please point me to any documentation on this. regards anandkl

Query Optimization

2007-03-12 Thread Drew Kutcharian
Hi All, How can I optimize the following 3-way JOIN SQL query given then following schema: SELECT ORDER.ID, ORDER.STATUS, ORDER.ORDER_TIME, ORDER_ITEM.ID, ORDER_ITEM.QUANTITY, PRODUCT.SIZE, PRODUCT.SHAPE, PRODUCT.PAPER, PRODUCT.TURNAROUND FROM ORDER, ORDER_ITEM, PRODUCT W

Re: ENCODE() and DECODE()

2007-03-12 Thread Neil Tompkins
Do you think these functions would be ideal for my requirements in terms of encrypting credit card numbers when stored in a database ? From: "Wm Mussatto" <[EMAIL PROTECTED]> To: "Neil Tompkins" <[EMAIL PROTECTED]> CC: mysql@lists.mysql.com Subject: Re: ENCODE() and DECODE() Date: Mon, 12 Ma

Re: ENCODE() and DECODE()

2007-03-12 Thread Wm Mussatto
On Mon, March 12, 2007 13:04, Neil Tompkins said: > Sorry Bill, I'm unsure what you mean by bin My error, too early in the morning here 'blob' > >>From: "William R. Mussatto" <[EMAIL PROTECTED]> >>To: mysql@lists.mysql.com >>Subject: Re: ENCODE() and DECODE() >>Date: Mon, 12 Mar 2007 10:31:53 -0700

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
So with a unique index on ItemI + AttributeID + Attribute_Value, this could be the statement: INSERT INTO bm_ItemsAttributes (ItemID, AttributeID, Attribute_Value) IGNORE SELECT DISTINCT(bmIA1.ItemID) FROM bm__ItemsAttributes bmIA1, '31', 'default text'; which should result in a new row co

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
So with a unique index on ItemI + AttributeID + Attribute_Value, this could be the statement: INSERT INTO bm_ItemsAttributes (ItemID, AttributeID, Attribute_Value) IGNORE SELECT DISTINCT(bmIA1.ItemID) FROM bm__ItemsAttributes bmIA1, '31', 'default text'; which should result in a new row co

Re: tool to migrate data from oracle to mysql

2007-03-12 Thread David Griffiths
SQLWays also works, and it does stored procedures, etc, but it's thousands of dollars (depending on the # of objects in your database). http://www.ispirer.com/products/ David Arun Kumar PG wrote: http://www.mysql.com/products/tools/migration-toolkit/ There is a video presentation as well h

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Brent Baisley
Skip the whol SELECT part an create a unique index on the fields you want unique (AttributeID, Attribute_Value). Then just do an INSERT IGNORE. The index will prevent a new non-unique from being entered and the IGNORE will prevent an error. - Original Message - From: "Miles Thompson" <[

INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
I want to add records to an attributes table for every item which does not have an attribute of a given value. The problem is that some records have already had these values added. Please have a look at the following query, an INSERT ... SELECT construct which I believe will do the job: INSE

RE: Function in Query has Terrible Impact on Indexes Used

2007-03-12 Thread Caplan, Michael
Hi Brent, That's the ticket! I swapped SYSDATE out for NOW. Thanks to the two of you!!! Mike -Original Message- From: Brent Baisley [mailto:[EMAIL PROTECTED] Sent: March 12, 2007 3:50 PM To: Little, Timothy; Caplan, Michael; mysql@lists.mysql.com Subject: Re: Function in Query has

RE: Function in Query has Terrible Impact on Indexes Used

2007-03-12 Thread Caplan, Michael
Hi Tim, Thanks for the reply. Good guess, but no dice. The table structure is as follows: CREATE TABLE `f_trans_lines` ( `TLINE_SEQ` int(11) default NULL, `TLINE_TRANS_KEY` int(11) default NULL, `TLINE_WCODE` varchar(8) default NULL, `TLINE_ACCOUNT` varchar(8) default NULL, `TLINE_UNI

Re: Function in Query has Terrible Impact on Indexes Used

2007-03-12 Thread Brent Baisley
The SYSDATE() function is not evaluated once, it's evaluated for each record. An index can't be used because the value may change at any time. Just as if you were using RAND() instead, it can't be preparsed. You can put the result of SYSDATE() into a variable and then use the variable in the query

RE: Function in Query has Terrible Impact on Indexes Used

2007-03-12 Thread Little, Timothy
My guess, without seeing your database CREATE TABLE statement for this particular table would be that the DATE_FORMAT returns a string, while the LAST_DAY function returns a date-time. If your TLINE_INV_DATE is a VAR/CHAR then use DATE_FORMAT around the LAST_DAY. If TLINE_INV_DATE is a DATE/TI

mysql 4.11, left joins, multiple tables

2007-03-12 Thread Andrew Wallace
Hi - I'm having an issue with left joins and multiple tables. I have a table which is a fairly simple name-value pair table: create table { acnt char(20), item char(40), value char (60) } I want to pull out all of a subset of the values for a particular account. It works for two of

WOW: Function in Query has Terrible Impact on Indexes Used

2007-03-12 Thread Caplan, Michael
Hi There, I'm having terrible results with a query that uses functions to define dynamically conditions in the WHERE clause. However, if I change the query to not use these functions, the query flies because it uses proper indexes. The query without functions is as follows: SELECT

Re: ENCODE() and DECODE()

2007-03-12 Thread William R. Mussatto
On Mon, March 12, 2007 8:04, Neil Tompkins said: > I've been researching the best method to store credit card numbers in a > database which are saved encrypted. My version of mysql is 3.23 therefore > I > think the only function I could use is > > ENCODE() and DECODE(). > > I've tried these functi

Re: tool to migrate data from oracle to mysql

2007-03-12 Thread Martijn Tonies
Hi, > Does any body know of any tool available for migrating data from oracle to > mysql. Can you please pass on the url. You might want to try our Database Workbench tool: www.upscene.com It includes a Schema Migration and DataPump tool. Martijn Tonies Database Workbench - tool for InterBase,

ENCODE() and DECODE()

2007-03-12 Thread Neil Tompkins
I've been researching the best method to store credit card numbers in a database which are saved encrypted. My version of mysql is 3.23 therefore I think the only function I could use is ENCODE() and DECODE(). I've tried these functions and they appear to work as I want. I've a couple of qu

RE: FW: Re: MD5()

2007-03-12 Thread Neil Tompkins
I just tried and it appears the functions DO NOT work in version 3.23 From: "Neil Tompkins" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Subject: FW: Re: MD5() Date: Mon, 12 Mar 2007 09:28:27 + I thought the DES_ENCRYPT/DES_DECRYPT functions were released in mysql version 4 however th

RE: tool to migrate data from oracle to mysql

2007-03-12 Thread Tangirala, Srikalyan
Hi All: We are trying to migrate the oracle database to mysql using the MySQL migration kit. During the process, when we have specified the source and target information and tried to establish a connection, the error we have got is the following: Connecting to source database and retrieve

Re: Finding a Solution To A Distinct Problem of Mine

2007-03-12 Thread Brent Baisley
If you are looking for the latest created_at date, then you want to be grabbing the max value of that field. SELECT DISTINCT from_user_id, max(created_at) FROM messages WHERE to_user_id = 1 GROUP BY from_user_id; In your original query I think you meant to select from, not to, since to will be

MySQL Community Server 5.0.37 has been released

2007-03-12 Thread Mads Martin Joergensen
Dear MySQL users, MySQL Community Server 5.0.37, a new version of the popular Open Source Database Management System, has been released. The release is now available in source and binary form from our download pages at http://dev.mysql.com/downloads/ and mirror sites. Note that not all mirro

FW: Re: MD5()

2007-03-12 Thread Neil Tompkins
I thought the DES_ENCRYPT/DES_DECRYPT functions were released in mysql version 4 however they work with my version of mySQL 3.23 ? Neil From: "Neil Tompkins" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Subject: FW: Re: MD5() Date: Sat, 10 Mar 2007 18:24:19 + Strange the DES_ENCRYPT/