Re: a strange problem

2008-04-23 Thread Sebastian Mendel
liaojian_163 schrieb: hi,all. In my mysql server,I have a strange problem. can someone help me? Thank you. mysql select id,classid,newstime from phome_ecms_zhichang where classid=41 and id 2500 order by id desc limit 10; +--+-+-+ | id | classid |

Re: Weird result on max compared to order by

2008-04-23 Thread Sebastian Mendel
[EMAIL PROTECTED] schrieb: Hi, I did a select on a primary key.. Select max(account_id) from mytable; -- it gave me a value X I did a select with order by Select account_id from mytable order by account_id desc limit 3 -- it gave me a value of Y ( Y is the

Re: SQL question: find items tagged with specific tags

2008-04-23 Thread Ingo Weiss
Thanks, Sebastian! I have tried this one before. The problem is that it finds all items the tags of which include EITHER 'blue' OR 'red', not 'blue' AND 'red': mysql SELECT DISTINCT items.title from items inner join taggings on (items.id = taggings.item_id) inner join tags on (tags.id =

Re: SQL question: find items tagged with specific tags

2008-04-23 Thread Sebastian Mendel
Ingo Weiss schrieb: Thanks, Sebastian! I have tried this one before. The problem is that it finds all items the tags of which include EITHER 'blue' OR 'red', not 'blue' AND 'red': oh ... and ..., i missred SELECT DISTINCT items.* FROM items INNER JOIN taggings ON

Rewriting query to avoid inline view

2008-04-23 Thread Morten Primdahl
Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a start_date and an end_date. One way to solve this problem, is to create an inline view in the

Re: a strange problem

2008-04-23 Thread liaojian_163
thank you Sebastian! I have re-created the table.there are not any problems in the table. if the table is new,need to rebuild de indexes? - Original Message - From: Sebastian Mendel [EMAIL PROTECTED] To: liaojian_163 [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Sent: Wednesday, April 23,

Symlink InnoDB tables without stoping MySQL

2008-04-23 Thread Dobromir Velev
Hi, What I'm trying to do is to create a new InnoDB table on a different disk and symlink it to an existing database. I have innodb_file_per_table turned on and here is how I tried to do it mysql \u test mysql create table test (...) ENGINE = 'InnoDB'; mysql\q move the test.ibd file to the

Re: a strange problem

2008-04-23 Thread Sebastian Mendel
liaojian_163 schrieb: thank you Sebastian! I have re-created the table.there are not any problems in the table. if the table is new,need to rebuild de indexes? no -- Sebastian Mendel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Rewriting query to avoid inline view

2008-04-23 Thread Baron Schwartz
Hi, On Wed, Apr 23, 2008 at 8:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a

Re: Symlink InnoDB tables without stoping MySQL

2008-04-23 Thread Sebastian Mendel
Dobromir Velev schrieb: Hi, What I'm trying to do is to create a new InnoDB table on a different disk and symlink it to an existing database. I have innodb_file_per_table turned on and here is how I tried to do it mysql \u test mysql create table test (...) ENGINE = 'InnoDB'; mysql\q move

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 5:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a start_date and

Re: Rewriting query to avoid inline view

2008-04-23 Thread Sebastian Mendel
Baron Schwartz schrieb: Hi, On Wed, Apr 23, 2008 at 8:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events

Re: Symlink InnoDB tables without stoping MySQL

2008-04-23 Thread Dobromir Velev
Hi, Thanks for pointing it out - I just found the following commands. ALTER TABLE tbl_name DISCARD TABLESPACE; ALTER TABLE tbl_name IMPORT TABLESPACE; I will test it and let you know if it works Thanks Dobromir Velev On Wednesday 23 April 2008 16:27, Sebastian Mendel wrote: Dobromir Velev

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 6:31 AM, Sebastian Mendel [EMAIL PROTECTED] wrote: Baron Schwartz schrieb: SQL magic i knew that you would answer this ... ;-) And he did it a minute or so faster than me... (though I did rip off his integers table way back when) -- Rob Wultsch [EMAIL PROTECTED]

Re: Rewriting query to avoid inline view

2008-04-23 Thread Morten Primdahl
Thanks Rob and Baron, I'd never heard of the integers table approach before, really good stuff! First off your porting over or dealing with formerly oracle code, right? Nah, I just learned SQL on Oracle back in the day. DUAL works under MySQL also - don't know since what revision, but

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 6:39 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Thanks Rob and Baron, I'd never heard of the integers table approach before, really good stuff! If memory serves postgres has something similar built in, so the syntax is something like seq(1..100) or something like

mysqldump

2008-04-23 Thread Kaushal Shriyan
Hi I get # mysqldump -u root -p dashboard /home/mysql_backup/dashboard.sql Enter password: mysqldump: Got error: 1033: Incorrect information in file: './dashboard/Actions.frm' when using LOCK TABLES what am i missing Thanks and Regards Kaushal

Upgrading from 4.1 to 5.0

2008-04-23 Thread Paul Choi
Does anyone have experience with upgrading large databases (~500GB each) from MySQL 4.1 to 5.0? The tables are in InnoDB format. We are using the Community version. I've read that it's recommended that you use mysqldump and then restore, but this is not possible for us, as we cannot have our

Starting a 2nd MySQL instance on UNIX

2008-04-23 Thread Mark-E
I have a Solaris box where MySQL 4.0.20 instance is running (to support Bugzilla 2.22). I have loaded mysql5.0 on the same box (for Bugzilla 3.0.3) and created a new mysql50 user that I want to use to run this instance with. I tried to start the instance on another port by running the following

RE: Symlink InnoDB tables without stopping MySQL

2008-04-23 Thread Jerry Schwartz
If Linux works the same way as HP-UX (and it should), anything you do to an open file (including deleting it) has no effect until the file is closed. The MySQL server is still using the old file. The next time it stops and restarts, it will follow the symlink. I don't know what the effect of

C API routines and cobol

2008-04-23 Thread Michael
Has anyone successfully called the C API routines for MySQL from COBOL? If so how are the parms defined in COBOL? -- Michael Anderson, J3k Solutions Sr.Systems Programmer/Analyst 832.515.3868 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

TO_DAYS Date Range Question

2008-04-23 Thread David Perron
Hello Users- I think I have an interesting question with regards to applying a function to date range, I think half of problem solving is explaining it to an audience so please, bear with me. There is a table Orders that has two DATE columns, StartDate and EndDate. The range of dates can vary

Slow Queries

2008-04-23 Thread D Hill
I have something I am trying to resolve with an over abundant number of slow queries. Perhaps it is because of some additional indexes needed. As soon as I enabled the option 'log_queries_not_using_indexes = 1' in the configuration file, I started getting messages relating to the select

Re: Upgrading from 4.1 to 5.0

2008-04-23 Thread Brent Baisley
You may want to try replication. Setup your replication server as 5.0. That server gives you a chance to play to get things right without affecting the master server. You'll still need to do a dump to get the slave up to speed. Once you get everything right, you can switch over and the

Aggregation question

2008-04-23 Thread Gary Greenberg
I have a table that stores performed transactions and I need to build a histogram of a number of transactions per day in the requested period. So, I made a simple query with the group by clause which returns me what I need: 2008-04-16 65456204 2008-04-17 190838546 2008-04-18

Re: Aggregation question

2008-04-23 Thread Michael Cole
On Thursday 24 April 2008 12:26:09 pm Gary Greenberg wrote: except that there is no entry for April 20th as there were no transactions at that day. I need a query to return me zero for that day. I.e. I need uninterrupted sequence of dates. I am beating my head at this problem for the whole day

Re: Slow Queries

2008-04-23 Thread Perrin Harkins
On Wed, Apr 23, 2008 at 9:22 PM, D Hill [EMAIL PROTECTED] wrote: Can anyone shed some light if I should index wite_desc to speed things up? No, since you don't use that column at all. If you're not on MySQL 5, upgrading to MySQL 5 will help. Otherwise, you're best bet is to rewrite the query