First and Last timestamp of the day/week / month

2010-04-22 Thread Cantwell, Bryan
I need to be able to get a first and last timestamp for a day a week or a month. I have an example of what I did so far that gets me that info for a week... but I fear that it is far more complex than it needs to be. Anyone have a simple way to get first and last timestamp for these intervals?

Index analyser

2010-02-23 Thread Cantwell, Bryan
Is there still no such thing anywhere for Mysql as an index analyser? Many others have such a thing that will sit and monitor db activity over a poeriod of time and suggest the exact indexes on each table based on what it has seen to improve performance Anyone got that for MySQL?

RE: Index analyser

2010-02-23 Thread Cantwell, Bryan
Ya, that one is helpful... just trying to land on a solution like I've seen in other DB's that have index-advisor that listens and creates what it thinks is the perfect indexes ... but thx... From: mos [mo...@fastmail.fm] Sent: Tuesday, February 23,

compare column value to anything in a list of values

2010-02-17 Thread Cantwell, Bryan
Is there a simple function or method to compare a value in a column to one or more items in a comma separated list? select * from table where value contains one of ('apple','orange','banana'); and say value may = something like 'produce(grape,orange,pear,apple,lettuce)' -- MySQL General Mailing

RE: compare column value to anything in a list of values

2010-02-17 Thread Cantwell, Bryan
: Wednesday, February 17, 2010 11:31 AM To: Cantwell, Bryan Subject: Re: compare column value to anything in a list of values yes, there is... IN SELECT * FROM tbl WHERE col IN (v1, v2, v3) - Original Message - From: Cantwell, Bryan Date: Wednesday, February 17, 2010 12:25 pm Subject

dynamic sql using INTO

2010-02-17 Thread Cantwell, Bryan
I have a function built that will get me X percentile from my history table for last X days. It works fine as long as I hard code the certain values in where they go... what I really need to know is how can I make dynamic sql still do a select into a variable? simply replacing the '31' below

Lesser of two values in list

2009-12-17 Thread Cantwell, Bryan
I need to find the lesser of two values provided in a list. I know I can do it with a couple of IF's in a function, but I'd really like to know if there is already a function that I can use. min(12,3,1,4) of course doesnt work, but is there some other math function I am overlooking in MySql?

Return row even if nothing found

2009-12-15 Thread Cantwell, Bryan
I have a situation where I need to always get a row returned even if no match is in the table (only 1 or many rows are acceptable). I can use: select a, b, c from mytable where a = 'yarp'; and might get 20 rows if there are matches, but I at least need 1 default row back... using : select

RE: Replication recovery on restart

2009-07-31 Thread Cantwell, Bryan
- From: Gavin Towey [mailto:gto...@ffn.com] Sent: Thursday, July 30, 2009 5:08 PM To: Cantwell, Bryan; mysql@lists.mysql.com Subject: RE: Replication recovery on restart Hi Bryan, Please define out of whack. Tell us exactly what you're doing when you restart, and what the replication state

RE: Replication recovery on restart

2009-07-31 Thread Cantwell, Bryan
- From: Gavin Towey [mailto:gto...@ffn.com] Sent: Friday, July 31, 2009 1:21 PM To: Cantwell, Bryan; mysql@lists.mysql.com Subject: RE: Replication recovery on restart Bryan, How are you restarting mysql? In the case a master crashes, it's definitely common for the slave to miss the fact

Replication recovery on restart

2009-07-30 Thread Cantwell, Bryan
I have 2 machines 'master' and 'slave'. I have the mysql 5.0.51a-log databases both replicating wonderfully. They are configured in a dual master scenario so that one can take over for the other in my HA environment I've built. All is working great until... If one or the other box reboots or

Replication switch Master to slave and back

2009-07-08 Thread Cantwell, Bryan
I have successfully set up a replication master/slave scenario with my MySQL 5.0.51a Now in the event of a fail over to the slave (an identical appliance), I want the old master to become the slave for an eventual switch back the other way. Would it really take the same process to keep the old

Create function ignore deps

2009-05-27 Thread Cantwell, Bryan
I want to check all my functions and procs into my svn as individual sql files. When I use these to create my db, the person doing this may not realize the correct order to run these files and not have dependency challenges... How can I have procs that depend on functions, or vice versa, get

Index time columns?

2009-04-24 Thread Cantwell, Bryan
I have a debate with someone about indexes on time columns. So I ask the community, should you put an index on a timestamp column of a table? Thanks...

Size limitation of user variable?

2009-02-10 Thread Cantwell, Bryan
I am trying to put the result of a function that returns MEDIUMTEXT into a user variable in my procedure. I haven't attempted to push the limits of the MEDIUMTEXT size, but wonder if the user variable can even handle this? -- MySQL General Mailing List For list archives:

Function call reult in a WHERE-IN clause

2008-12-17 Thread Cantwell, Bryan
I have a function that I built that returns a string that is really a comma separated list of values (below). I would like to use that returned value in an IN clause in sql. : select * from hosts where hostid in (getHosts(10014)); The function: CREATE FUNCTION getUserHosts(userID

create single resultset from multiple sets

2008-12-02 Thread Cantwell, Bryan
I have a procedure (proc1) that calls another procedure (proc2) several times. I'd like to make proc1 return the proc2 results in a single resultset. How can this be done in mysql 5.0.51? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
Below I have a function with a cursor. I have tested the cursor sql manually and it is fine, I have put the variables into the sql inside the cursor loop and it returns data too, BUT, executing this function returns null even though I know the correct info is available. Am I missing something

RE: Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
return a record in this pass? thx -Original Message- From: Cantwell, Bryan [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2008 4:17 PM To: mysql@lists.mysql.com Subject: Function returns null when running sql manually works Below I have a function with a cursor. I have tested

RE: Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
Message- From: Cantwell, Bryan [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2008 5:13 PM To: mysql@lists.mysql.com Subject: RE: Function returns null when running sql manually works OK, I know WHY it is returning null, just not WHAT to do about it. In the inside sql