Re: Query ranges

2007-02-04 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Jerry Jones") wrote in news:[EMAIL PROTECTED]: > I am trying to do an update, where item numbers 1-9 get four 0's added > to the front, 10-99 get three 0's etc. mysql> HELP LPAD Name: 'LPAD' Description: Syntax: LPAD(str,len,padstr) Returns the string str, left-padded with t

Re: mysqldump

2007-02-02 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Phil Butterworth") wrote in news:[EMAIL PROTECTED]: > Is their a way to disable constraints for the new > tables, then when all the tables are created the FK's are put into > place, so no create table statement errors because of FK's, and no > editing the sql dump? SET FOREIG

Re: Password hash should be a 41-digit hexadecimal number

2007-02-02 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Padmanabhan G") wrote in news:[EMAIL PROTECTED]: > mysql> create user [EMAIL PROTECTED] identified by password 'openpne'; > > Error 1372: Password hash should be a 41-digit hexadecimal number mysql> create user [EMAIL PROTECTED] identified by 'openpne'; -- felix -- MySQ

Re: Safe DB Distribution

2007-01-30 Thread Felix Geerinckx
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED] R04.sysops.aol.com: > Something like distributing files with encrypted data in most columns > can be done I think the OP is more concerned with protecting his datamodel, and this cannot be done in my opinion. -- felix -- MySQL General Mailing

Re: Safe DB Distribution

2007-01-30 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Suhas Pharkute") wrote in news:[EMAIL PROTECTED]: > I want to distribute the MySQL DB to different user with an PHP web > app. Make sure you have read and understood the MySQL licensing policy, if your app is not open source (as it seems to be). > My biggest problem is MyS

Re: Alias a function result?

2007-01-24 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Jerry Schwartz") wrote in news:[EMAIL PROTECTED]: > SELECT book_author, GROUP_CONCAT(book_title) AS book_title GROUP BY > book_author WHERE book_title LIKE ""; > > This actually seems to work, but it makes me ill to look at it. I doubt this works: there is no FROM clause,

Re: Unable to put data on a different computer from mysql

2007-01-23 Thread Felix Geerinckx
[EMAIL PROTECTED] (Kelly Solakofski) wrote in news:[EMAIL PROTECTED]: > I've been trying to put the data onto our data drive, and the mysql > application on the main server. I've edited the my.ini file > correctly. I can get it to work on different drives where the data is > on the same comput

Re: Query skips one set of records

2007-01-19 Thread Felix Geerinckx
[EMAIL PROTECTED] (Miles Thompson) wrote in news:[EMAIL PROTECTED]: > This query: > > SELECT > member_id, > member_sub_id, > IF( ( monthly_cost = 10 ), ( SUM(( monthly_cost * 2.00 ) + 200 ) > ), ( SUM( > monthly_cost * 12.00 ) ) ) AS Amount > FROM subinfo > WHERE > MON

Re: Row position in table when sorted?

2007-01-12 Thread Felix Geerinckx
[EMAIL PROTECTED] (Nuno Oliveira) wrote in news:[EMAIL PROTECTED]: > (Off-Topic: I'm using Thunderbird/1.5 & Gmail and I do a Reply All > which sends the messages to the person I'm replying and CC's to the > list but I never receive my own messages. Is this the normal behavior? > Thanks) Lookin

Re: Row position in table when sorted?

2007-01-12 Thread Felix Geerinckx
[EMAIL PROTECTED] (Nuno Oliveira) wrote in news:[EMAIL PROTECTED]: > My problem/question is how can I know the link for each one of these > found records??? Which is the for the LIMIT??? The way to retrieve individual records is by id, not by LIMIT n, m: SELECT * FROM Clients WHERE id = <>

Re: how to take advantage of STR_TO_DATE

2007-01-11 Thread Felix Geerinckx
[EMAIL PROTECTED] (Gilles MISSONNIER) wrote in news:[EMAIL PROTECTED]: > I rewrite my question in a simpler (?) way : > How could I load in the database, data from a text file containaing > date in a NOT MySQL standard date format [precisely char(10)], so that > I get the date into a MySQL standa

Re: Need any that can translate this

2007-01-11 Thread Felix Geerinckx
[EMAIL PROTECTED] (Tomás Abad Fernández) wrote in news:[EMAIL PROTECTED]: > I dont know why thease don't work at MySql 3.21 , anyone can help me > to make this compatible with mysql3? 3.21 is really ancient ... > > $query = "SELECT * FROM facturas WHERE pedido IN (SELECT orders_id > FROM order

Re: Strange query.

2007-01-11 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Paul Halliday") wrote in news:[EMAIL PROTECTED]: > Could you expand a little on how that works? USE test; DROP TABLE IF EXISTS event; CREATE TABLE event (timestamp DATETIME NOT NULL); INSERT INTO event (timestamp) VALUES ('2007-01-09 20:02:15'), ('2007-01-09 20:02:15'), ('200

Re: Strange query.

2007-01-10 Thread Felix Geerinckx
[EMAIL PROTECTED] ("Paul Halliday") wrote in news:[EMAIL PROTECTED]: > I am trying to deal with empty values so that I can graph data over a > 24 hour period without gaps. Have a look here: http://forums.mysql.com/read.php?10,133603,133607#msg-133607 -- felix -- MySQL General Mailing List

Re: SUM in WHERE

2006-09-21 Thread Felix Geerinckx
On 18/09/2006, "Ahmad Al-Twaijiry" wrote: > I want to run SQL query that will return to me the first records that > the SUM of Total field = 100 USE test; DROP TABLE IF EXISTS foo; CREATE TABLE foo ( id INT UNSIGNED NOT NULL PRIMARY KEY, total INT NOT NULL); INSERT INTO foo VALUES (1, 20), (2,

Re: Merge tables: how to get the "insert_method"?

2006-03-07 Thread Felix Geerinckx
On 07/03/2006, [EMAIL PROTECTED] wrote: > "insert_method" ?? > > I thought I knew a little about databases and table design but that's > a new term for me. What does it mean and how would I apply it in > order to modify a table's contents? >From http://dev.mysql.com/doc/refman/5.0/en/merge

Re: LIMIT on GROUP BY?

2005-12-29 Thread Felix Geerinckx
On 28/12/2005, [EMAIL PROTECTED] wrote: > I don't think there is any way with plain-old SQL (extended or > otherwise) to do it in a single statement (unless you are doing it > iteratively - that is: in a stored procedure and row-by-row). USE test; DROP TABLE IF EXISTS foo; CREATE TABLE foo (

Re: Delete query problem

2005-12-21 Thread Felix Geerinckx
On 21/12/2005, Dušan Pavlica wrote: > Hello, > I have master-detail tables and I would like to delete in one > statement master record and all detail records but not every master > record has details. MySQL versions 4.1.10 and higher. Could someone > help me, please, to create such a query? >

Re: Slow sorting

2005-12-20 Thread Felix Geerinckx
On 20/12/2005, Marcus Bointon wrote: > I have a table that contains around 400,000 simple names. It's > displaying a subset of them (perhaps 5,000) them a page at a time in > a web interface, sorted by name, so I have a query like this: > > SELECT * FROM names WHERE account=123 ORDER BY lastname,

Re: How to use 'if' in select

2005-11-28 Thread Felix Geerinckx
On 28/11/2005, Gobi wrote: > I need to write a select clause based on the following conditions: > > If all rows of status1 == "Neg" > count all "Neg" rows in status1 > else > check if all rows of status2 == "Neg" > count all "Neg" rows in status2 and status1 > endif > endif Not sure if I under

Re: 4.1 password problem

2005-11-24 Thread Felix Geerinckx
On 24/11/2005, Lowell Allen wrote: > but I'm looking for a way to convert the short hash values into > comparable long hash values. This is (fortunately) *not* possible. > Apparently the upgrade procedure can successfully convert > short-to-long hash values for MySQL user passwords It doesn'

Re: LIMIT in subquery or GROUP_CONCAT

2005-11-18 Thread Felix Geerinckx
On 17/11/2005, Peter Brodersen wrote: > I would like to select top three from different parts in the same > table, e.g. for the following data set: USE test; DROP TABLE IF EXISTS foo; CREATE TABLE foo ( fid INT NOT NULL, d INT NOT NULL ); INSERT INTO foo VALUES (1, 10), (1, 20),

Re: Between used with date fields

2005-10-07 Thread Felix Geerinckx
On 07/10/2005, Erfan Shirazi wrote: > It works fine, no errors and it seems to get correct data but the > mysql manual and some other books doesn't mention anything about > BETWEEN being used like this and therefor I'm not completely sure, > anybody with any experience with my example? I regularl

Re: Between used with date fields

2005-10-07 Thread Felix Geerinckx
On 07/10/2005, Erfan Shirazi wrote: > I have a question about BETWEEN. > Could it be used to look up fields which have a date between to date > fields? > > Ex: '2005-10-07' BETWEEN tEffectivedate AND tExpirationdate > > tEffectivedate and tExpirationdate are DATE types. What happened when you t

Re: alter table

2005-10-06 Thread Felix Geerinckx
On 06/10/2005, "s. keeling" wrote: > Incoming from Arno Coetzee: > > s. keeling wrote: > > > alter table MEMBERS > > >alter MEMBER_INFO varchar(160); > > > > > > ERROR 1064: You have an error in your SQL syntax. > > > > http://dev.mysql.com/doc/mysql/en/alter-table.html > > Yes, I've read i

Re: Help with query using IN()

2005-10-05 Thread Felix Geerinckx
On 04/10/2005, Jasper Bryant-Greene wrote: > Kishore Jalleda wrote: > > Could you kindly advice if this query can be made to run faster > > SELECT title, template > > FROM template > > WHERE templateid IN > > (608,2072,2073,1888,1898,1895,1897,1894,1896,1901,1903,1889,1900,189 > > 0,1891,1902,1904

Re: linux timestamp

2005-09-27 Thread Felix Geerinckx
On 27/09/2005, Dotan Cohen wrote: > Hi all, I have a field in a mysql database v4.0.18 that contains a > linux timestamp. I have been googleing for a solution that would > return to me all the entries where the timestamp falls on, say a > wednesday, or between 2pm to 3pm. SET @uts := UNIX_TIMEST

Re: unexpected EXPLAIN result with subselect

2005-09-14 Thread Felix Geerinckx
On 14/09/2005, "Matthias Pigulla" wrote: > However - why do we need the dependent subquery at all? The subquery > can be executed on its own, as it does not depend on any information > of the "superquery". This is a subquery optimizer bug. See http://bugs.mysql.com/bug.php?id=10309 -- felix -

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Felix Geerinckx
On 24/08/2005, "Praveen KS" wrote: > Can anyone help with a query to retrieve latest N records. > > No auto_increment field. > No date field. > Primary key exists and is populated with random unique values. In a table, there are no such things as - the first record - the twenty third record

Re: password(), sha1() and md5()

2005-08-18 Thread Felix Geerinckx
On 18/08/2005, Martin Schwarz wrote: > When using > 'update TABLE set FIELD=PASSWORD('foo');' > the query > 'select * from TABLE where FIELD=PASSWORD('foo');' > delivers an empty set. > > Same with the SHA1 or MD5 functions. What is the data type of your FIELD column? -- felix -- MySQL Gener

Re: Order By Question

2005-08-18 Thread Felix Geerinckx
On 17/08/2005, Schimmel LCpl Robert B wrote: > If I do a select * from the table > without an order by clause, I get the results in the order which they > were entered into the table (which is how I want them). This is not correct (e.g. on a MyISAM table in which you have done deletes - see exam

Re: query

2005-08-16 Thread Felix Geerinckx
On 16/08/2005, "Octavian Rasnita" wrote: > I want to create a query that selects the diference between the value > of a field from the current record and the value of the same field > from the previous record. How do you define "current record" and "previous record"? (relational databases are not

Re: ORDER BY and ENUM -- not alphabetical

2005-06-09 Thread Felix Geerinckx
Or put the members alphabetically in the enum definition in the first place ... -- felix On 09/06/2005, Eric Bergen wrote: > It's not a bug at all. You just hit one of the features of enum :) > > If you want to order alphabetically as you describe cast the enum > name to a string like this se

Re: Slow LIMIT Query

2005-06-06 Thread Felix Geerinckx
On 05/06/2005, "Doug V" wrote: > In your followup message [from [EMAIL PROTECTED], you mention reverse > sorting the query. I imagine on the application side I would need to > reverse sort again to get the correct order. Are there any other ways > to speed up such a query? I find similar beha

Re: EXISTS

2005-06-01 Thread Felix Geerinckx
On 31/05/2005, Lucio Crusca wrote: > I use mysql 4.0.24 as found in debian gnu/linux sarge. > mysql> select * from SAMPLES S1 where exists (select * from SAMPLES > S2 where S1.ID = S2.ID); > > ERROR 1064: You have an error in your SQL syntax. Check the manual > that corresponds to your MySQL ser