Re: Query

2006-08-04 Thread chris smith
On 8/5/06, Karl Larsen <[EMAIL PROTECTED]> wrote: I am using Linux called Fedora Core 4. I had no problem getting mysql 4 working here and liked it a lot. But when I discovered 4 doesn't have VIEW but 5 does I have tried several RPM sets of 5 that fail for basic reasons. The reasons are the w

Re: previous and next query

2006-08-04 Thread Jay Pipes
On Fri, 2006-08-04 at 17:14 -0700, Tanner Postert wrote: > select text from table where user = 2 and id < 3 order by id ASC limit 1; > select text from table where user = 2 and id > 3 order by id ASC limit 1; > > is it possible to do this using 1 query? select text from table where user = 2 and

RE: FW: How do I find all the users that are new since my last login (repost)

2006-08-04 Thread Daevid Vincent
I've thought about this a bit more since last night, and it seems that I can just use the built in 'CURRENT_DATE' (sp?) as it's a given that if they're logged in, then they're logged in NOW() which is == CURRENT_DATE minus the hh:mm:ss. I guess I could also store in a session (this is in PHP) the

Re: FW: How do I find all the users that are new since my last login (repost)

2006-08-04 Thread Martin Jespersen
You could add an extra field called last_login_date which you'd set only once per session - at login time. At login time you'd set this to the value that exists in login_date. Then use that for comparison against created_on. Daevid Vincent wrote: I have a SQL challenge I'm not sure how to sol

previous and next query

2006-08-04 Thread Tanner Postert
so i have a record set: id user text 1 2 ... 2 6 ... 3 2 ... 4 4 ... 5 2 ... 6 8 ... 7 1 ... 8 8 ... 9 2 ... so lets say I am looking at record 3. i need to know the previous record in the table that has that user, as well as the next record in the table that has that user. r

FW: How do I find all the users that are new since my last login (repost)

2006-08-04 Thread Daevid Vincent
I have a SQL challenge I'm not sure how to solve. But it's so common, I feel kind of stupid asking this... I have a 'user' table with 'login_date' which is an auto updated DATETIME column and a 'created_on' which is a DATETIME (but not updated after the record is created the first time) I want to

RE: Query Help for Loosely Couple Properties

2006-08-04 Thread Robert DiFalco
I think this only works if I "know" that "Orange" is the default value. For example if "Orange" is the default and I am searching for "Blue" I will have to use a different query. Since I don't know the default (its in the type table) I would have to do two queries. How about something like this? S

Re: Running Totals?

2006-08-04 Thread Barry Newton
Well, I said earlier that if I found a solution to this, I'd post it. Here it is, with many thanks to Nicholas Bernstein's timely July 7 post to the doc on user variables: It's not particularly elegant, it just gets the job done. If there is a cleaner way to do this, I'm not ashamed to be e

Query

2006-08-04 Thread Karl Larsen
I am using Linux called Fedora Core 4. I had no problem getting mysql 4 working here and liked it a lot. But when I discovered 4 doesn't have VIEW but 5 does I have tried several RPM sets of 5 that fail for basic reasons. The reasons are the wrong libraries or they are missing in total :-)

Re: MySQL Load Balancing

2006-08-04 Thread Peter Zaitsev
On Fri, 2006-08-04 at 15:54 -0400, Ed Pauley II wrote: > I am looking into a scale-out solution for MySQL. I have read white > papers and searched the web but I can't find a load balancer that claims > to work well for MySQL. MySQL's white paper shows NetScaler in the > scale-out stack but noth

Re: MySQL Load Balancing

2006-08-04 Thread Atle Veka
I should mention that the below concerns read-only daemons, Dan's post reminded me of that. Having multiple masters in a load balanced environment is extremely difficult to do right. I would wager that for most applications, at least internet related, you'll have a much higher read-to-write ratio

Re: Backup SQL

2006-08-04 Thread Chris White
On Friday 04 August 2006 11:26 am, Daniel da Veiga wrote: > Think better before you hit "send". Dude > -- -- Chris White PHP Programmer/DBarn Interfuel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: Backup SQL

2006-08-04 Thread John Meyer
If you're using Myphpadmin, you can turn this option off when generating the dump file. -Original Message- From: Chris White [mailto:[EMAIL PROTECTED] Sent: Friday, August 04, 2006 12:14 PM To: mysql@lists.mysql.com Subject: Re: Backup SQL On Friday 04 August 2006 10:35 am, Daniel da Vei

unexplained sigsegv, aborted backtrace

2006-08-04 Thread Danny Rathjens
I have an unexplained crash I am trying to figure out. This is a pretty static system, that has been running fine for a couple years. It crashed at 7:45am which is after any nightly bakups have all been done, so not even under any load. All other aspects of the system such as i/o,ram,cpu, number

unexpected trigger behavior on BEFORE UPDATE trigger using NEW. and OLD. column values

2006-08-04 Thread Ferindo Middleton
I have two databases that effect each other when triggers get excecuted. There is a schedules database that updates registration database. The problem I have is with the enrolled, attended, waitlisted, completed, cancelled, etc. booleans values. The registration db has triggers on it that enforce

Re: MySQL Load Balancing

2006-08-04 Thread Dan Buettner
Ed, in Jeremy Zawodny's (excellent) book "High Performance MySQL", there is a chapter on load balancing - though it's a bit more of a theoretical discussion than a how-to. There are a couple of commercial products mentioned briefly - Veritas and EMIC Networks. One idea he presents might work for

Re: MySQL Load Balancing

2006-08-04 Thread Atle Veka
You can have a simple LVS setup running with a plugin from Nagios, check_mysql, which will connect to the mysql daemon and run a status query. If you want anything more than that you most likely will have to write a custom check plugin (shouldn't be that hard). LVS works nicely as a mysql loadbalan

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Thanks Nestor! I think I am almost there. However, how can I limit the result of a JOIN in a query, and not the entire result set? For example: SELECT * FROM a JOIN b ON a.id = b.id If I wanted all records from "a" and only the first record from "b", how would I integrate a LIM

MySQL Load Balancing

2006-08-04 Thread Ed Pauley II
I am looking into a scale-out solution for MySQL. I have read white papers and searched the web but I can't find a load balancer that claims to work well for MySQL. MySQL's white paper shows NetScaler in the scale-out stack but nothing on Citrix.com mentions MySQL. I also read that friendster

Re: Tricky query

2006-08-04 Thread Morten
How about: SELECT DISTINCT `key`, COUNT(`key`) AS c FROM `table` WHERE `value` in (8,9,10) HAVING c=3; Clever! Thanks :-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Thanks Nestor, I thought about that, but limit 1 doesn't work in my scenario as I want to access both the FIRST() and LAST() column for a result set simultaneously. By telling MySQL to limit to 1, I could get the first, but not the last. I want mysql to give me the first, drop everything in

Re: Tricky query

2006-08-04 Thread Gerald L. Clark
Morten wrote: Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should t

Re: Tricky query

2006-08-04 Thread Gerald L. Clark
Morten wrote: Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should t

Re: Tricky query

2006-08-04 Thread Morten
Peter Brawley wrote: >Can this be expressed somewhat more elegantly than multiple EXISTS subqueries? >SELECT DISTINCT key FROM keyval outer >WHERE EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >AND inner.val = 8) >AND EXISTS (SELECT * FROM keyval inner >WHE

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
I just noticed that MSAccess and SQL server support FIRST() and LAST() functions. Is there an equivalent in MySQL? My research has come up with nil so far. Thanks, Michael Michael Caplan wrote: Hi there, I am trying to figure out how to "flatten" the result set of a join query using aggr

Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Hi there, I am trying to figure out how to "flatten" the result set of a join query using aggregate functions. For several fields (b.refering_url, c.string, b.first_page, b.last_page) I need to pull out the _first_ or _last_ item as ordered from the records returned from the join. However,

Re: mysqldump large file (>2GBs) : some tests

2006-08-04 Thread Ken Menzel
Hi, I just saw your e-mail. We use mysqldump on solaris 9 with large files all the time. Is the partition you are writng the file to mounted with the largefiles option in /etc/mnttab? Our mysql dump files are 25 gig. Ken - Original Message - From: "Duhaime Johanne" <[EMAIL PROT

Re: Tricky query

2006-08-04 Thread Peter Brawley
>Can this be expressed somewhat more elegantly than multiple EXISTS subqueries? >SELECT DISTINCT key FROM keyval outer >WHERE EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >AND inner.val = 8) >AND EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >

Re: determine safest value for max_connections

2006-08-04 Thread Kishore Jalleda
This might help you http://kjalleda.googlepages.com/maxconnbymysql Kishore Jalleda On 8/2/06, Rithish Saralaya <[EMAIL PROTECTED]> wrote: Hello folks. How do I determine what is the safest value that I can set for max_connections in my.cnf? The default value of 100 is proving to be a shortfal

Tricky query

2006-08-04 Thread Morten
Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should thus return 1 an

Re: Backup SQL

2006-08-04 Thread Daniel da Veiga
On 8/4/06, Chris White <[EMAIL PROTECTED]> wrote: On Friday 04 August 2006 10:35 am, Daniel da Veiga wrote: > What if each .sql contains a "DROP TABLE IF EXISTS" statement at the > start? Something to be carefull if its the program that generated the > backup likes to add this tags. What if my w

Re: Backup SQL

2006-08-04 Thread Chris White
On Friday 04 August 2006 10:35 am, Daniel da Veiga wrote: > What if each .sql contains a "DROP TABLE IF EXISTS" statement at the > start? Something to be carefull if its the program that generated the > backup likes to add this tags. What if my website code breaks? This train of "what if" type qu

Re: Another question on Cardinality??

2006-08-04 Thread Brent Baisley
I didn't say consider a table with a thousand rows, must have been someone elses response. But anyway, it comes down to knowing your data. If you know your data, then you can create the best set of indexes. I would almost never create an index on a field with a cardinality of 2. However, I would

Re: Backup SQL

2006-08-04 Thread Daniel da Veiga
On 8/4/06, Chris White <[EMAIL PROTECTED]> wrote: On Friday 04 August 2006 04:04 am, Kaushal Shriyan wrote: > mysql -u kaushal -h example.com -p drupal < > /home/kaushal/drupal/new/a-l.sql and then do > mysql -u kaushal -h example.com -p drupal < > /home/kaushal/drupal/new/m-s.sql Better would b

Re: Another question on Cardinality??

2006-08-04 Thread Philip Mather
Brent, Given that... You really have to match cardinality with distribution of values. ...sounds like hard work (well you actually have to think about it) and... considering all the above cases, what should I conclude? should I have indexes on these three fields? Looking for a specific answe

Re: Order by

2006-08-04 Thread Chris Sansom
At 1:00 +0200 4/8/06, Johan Höök wrote: what you can do is: SELECT [fields] FROM [table] WHERE id IN (id1,id2,id3...) ORDER BY FIELD([field],value1,value2,value3,...) Ooh - so I can. I didn't know that wrinkle for order by - though I did wonder if something like that should be possible. Th

Re: Another question on Cardinality??

2006-08-04 Thread Brent Baisley
It depends on the data, not the situation. How's that? FLD_4 is doubtful that you would want/need and index on it. This assumes an even distribution of both values (ie. male/female). Since you would be scanning half the table anyway, an index won't really help. Now if it's not an even distributi

SELECT duplicate set of rows

2006-08-04 Thread James Neff
Greetings, I need help with a select statement that finds duplicate sets of rows. I have a table like so: batch_data --- ID - int (auto inc) Record ID - int DataValue - VarChar(99) DataType - int With a sample of data like this: 1 100 1122A 1 2 100 1350G 1 3

Re: Backup SQL

2006-08-04 Thread Chris White
On Friday 04 August 2006 04:04 am, Kaushal Shriyan wrote: > mysql -u kaushal -h example.com -p drupal < > /home/kaushal/drupal/new/a-l.sql and then do > mysql -u kaushal -h example.com -p drupal < > /home/kaushal/drupal/new/m-s.sql Better would be: mysql -u kaushal -h example.com -p drupal < ~/dr

Re: db logic questions...

2006-08-04 Thread Philip Mather
Bruce, i had initially thought that i could have the following tbl structure: UniversityTBL ( name ID auto_increment, ) In a generic kinda "Best Practice", things I've picked up from various places way I'd recommend the following things: - 1) The first field always be the Primary Key an

db logic questions...

2006-08-04 Thread bruce
hi peter. i've got a couple of logic/layout questions that i'm grappling with. hope you don't mind my posting. i've had some responses from a few people on the icr/mysql but i'm not sure as to their level of mysql usage/skill. my test app is used to build a system of college class schedules. i w

Re: delimiter in mysql client

2006-08-04 Thread Asif Lodhi
Hi, I am replying back to my own post. Sorry, I forgot to mention that I am using mysql client on WinXP Pro SP2 and MySQL-5.0.22 is installed on the same machine. Any hints as to why mysql client is showing this behavior? Thanks in advance, -- Asif On 8/4/06, Asif Lodhi <[EMAIL PROTECTED]> w

Re: Can't get v5.0.22 to work;alternatives?

2006-08-04 Thread Asif Lodhi
On 8/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I filed bug #20941 (mysqld seg faults during instance configuration on XP pro, http://bugs.mysql.com/?id=20941) some time ago and have seen no real movement on fixing it. I'm dead in the water. I can't get MySQL v5.0 to work on my system.

ROLLBACK/COMMIT in Stored Procedures

2006-08-04 Thread Asif Lodhi
Hi, In my stored procedures, i want to ROLLBACK when I encounter any invalid values. However, as it happens, I cannot because MySQL does not support COMMIT/ROLLBACK functionality right now (as of ver. 5.0.22 on WinXP Pro). I am setting session variables (Set @XX="Error Message') according ot ea

delimiter in mysql client

2006-08-04 Thread Asif Lodhi
Hi, When I create scripts, I change the delimiter at the beginning of the create_table script from ";" (without quotes) to "//". At the end of the script, I change the delimiter back to the original ";". This is according to what is described in doc at www.mysql.com. However, when I run these

Checking List

2006-08-04 Thread Mike Blezien
Is this list still working ? Mickalo -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Backup SQL

2006-08-04 Thread Kaushal Shriyan
Hi I have a query is i have taken backup from druapl due to timeout error in three backup files a-l.sql m-s.sql t-z.sql Now my understanding is if i do mysql -u kaushal -h example.com -p drupal < /home/kaushal/drupal/new/a-l.sql and then do mysql -u kaushal -h example.com -p drupal < /home/kau

Re: Order by

2006-08-04 Thread Johan Höök
Hi Chris, what you can do is: SELECT [fields] FROM [table] WHERE id IN (id1,id2,id3...) ORDER BY FIELD([field],value1,value2,value3,...) /Johan Chris Sansom skrev: Yes, I have looked at the docs and can't find what I'm looking for. I'm doing a very simple query: SELECT [fields] FROM [table]

Order by

2006-08-04 Thread Chris Sansom
Yes, I have looked at the docs and can't find what I'm looking for. I'm doing a very simple query: SELECT [fields] FROM [table] WHERE id IN (id1,id2,id3...) Is there a way to return the results in the order they appear in the IN list? I'm sure there's something obvious and simple, but as a rel

Doubt on Index Merge??

2006-08-04 Thread Ratheesh K J
Hello all, I have a doubt on Index Merge. We are currently using MySQL server 4.1.11. As a part of DB management I am currently doing an analysis on all the Tables. While looking into the table structures, their columns and Indexes I found that most of the tables have an Index on fields that

Re: Another question on Cardinality??

2006-08-04 Thread Martin Jespersen
Have you considered reading up on basic database management? There are plenty of good material on the web for you to read where you can actually learn how to manage databases, so you don't have to ask others about every single detail. Ratheesh K J wrote: Hello all, Another question on card

Another question on Cardinality??

2006-08-04 Thread Ratheesh K J
Hello all, Another question on cardinality. Consider a table with 1000 rows and columnns. Details of the columns are as below: FLD_1 - int - cardinality 1000 - PRIMARY KEY FLD_2 - tinyint- cardinality 400 FLD_3 - varchar - cardinality 10 FLD_4 - varchar - cardinality 2 FLD_5 - varchar - ca

Table size??

2006-08-04 Thread Ratheesh K J
Helo all, Just wanted to know when should a Table be considered for partitioning ( or should it be archiving ). Almost all of our tables are of Innodb type. I am looking for an estimate rather than a "Depends on situation" kind of an answer. We have few of our table swhich are very huge ( in t

Re: Calculating birthdays and distances... Is there a bug?

2006-08-04 Thread Chris
Daevid Vincent wrote: I posted this as a comment on the page too, but I’m curious as to why the top solution is off by a day or so... Is this a bug or a rounding issue or what? Is there a way to "fix" the top one to work the way I expect/want it to work? I suspect it's because (as Jack Palance sa

Calculating birthdays and distances... Is there a bug?

2006-08-04 Thread Daevid Vincent
I posted this as a comment on the page too, but I’m curious as to why the top solution is off by a day or so... Is this a bug or a rounding issue or what? Is there a way to "fix" the top one to work the way I expect/want it to work? I suspect it's because (as Jack Palance said in 'City Slickers') "

Cardinality

2006-08-04 Thread Ratheesh K J
Hello all, Need an explanation for this: I did the following - SELECT DISTINCT COLUMN1 FROM TBL_XXX ; I got the foll result 1 2 3 4 5 7 8 10 11 12 13 14 16 17 18 19 20 21 23 24 25 26 27 28 29 30 --