Displaying date/time

2010-03-05 Thread Tompkins Neil
Hi I have a number of rows which have Date and Time data in. I want to display in the following formats based on the systems current time e.g under 1 hour 24min ago e.g under 1 day 16h 29min ago e.g over 1 day 1d 2h 29min ago e.g over 1 week 1w 4d 2h 29min ago How would this best be achieve

Re: Displaying date/time

2010-03-05 Thread prabhat kumar
Might be this will help you: there is a table called message with 3 colums - id, pubdate and message; You can get all messages from the last 5 minutes with the following example; SELECT TIMESTAMPDIFF(MINUTE, pubdate, now()), id, message from message where (TIMESTAMPDIFF(MINUTE, pubdate, now())

Master/Slave - trucate master table

2010-03-05 Thread Steven Staples
Good day everyone... I am working with a master/slave set up, and of course, we started it once the database tables were a combined size of 60gb+ We've got it running and in sync now, (stopped the master, deleted the bin files, rsync'd the database tables and restarted the master) and all has

Index not being used

2010-03-05 Thread Simon Kimber
Hi Everyone, I have the following table: CREATE TABLE `form_fields_items` ( `ID` int(11) NOT NULL auto_increment, `siteid` int(11) NOT NULL default '0', `fieldid` int(11) NOT NULL default '0', `value` varchar(150) NOT NULL default '', `sortorder` int(11) NOT NULL default '0',

Re: Master/Slave - trucate master table

2010-03-05 Thread Johnny Withers
Does START SLAVE fail? If so, what is the output of SHOW SLAVE STATUS? JW On Fri, Mar 5, 2010 at 10:11 AM, Steven Staples sstap...@mnsi.net wrote: Good day everyone... I am working with a master/slave set up, and of course, we started it once the database tables were a combined size of

Re: Index not being used

2010-03-05 Thread Johnny Withers
I don't have your data, so I do not really know if my results are correct. I created this table on my system and added two records: INSERT INTO form_fields_items(siteid,fieldid,`value`,sortorder) VALUES (1234,5678,'test1',0) ; INSERT INTO form_fields_items(siteid,fieldid,`value`,sortorder)

Re: Displaying date/time

2010-03-05 Thread Tompkins Neil
Hi That is kind of what I'm looking for. However I'd like to be able to display the difference between date 1 and date 2 like 1d 2h 29min ago Thanks Neil On Fri, Mar 5, 2010 at 3:32 PM, prabhat kumar aim.prab...@gmail.com wrote: Might be this will help you: there is a table called message

RE: Displaying date/time

2010-03-05 Thread Gavin Towey
That's probably something best done in your presentation (app) layer. If you must do this in mysql, then you'll probably want to write a stored function. -Original Message- From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Friday, March 05, 2010 10:27 AM To: prabhat kumar

Re: Index not being used

2010-03-05 Thread Ananda Kumar
you should change the column order for the index sitefieldsort. It should be (sortorder,siteid`,`fieldid`). regards anandkl On Fri, Mar 5, 2010 at 11:52 PM, Johnny Withers joh...@pixelated.netwrote: I don't have your data, so I do not really know if my results are correct. I created this