Re: Get date from unix_timestamp only up to the hour

2011-02-24 Thread Nathan Sullivan
Bryan, Maybe something like this would work? select 1296158500 - (1296158500 % 3600) Hope that helps, Nathan On Thu, Feb 24, 2011 at 08:41:58AM -0800, Bryan Cantwell wrote: How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For

Re: Can this be done with a single query?

2010-10-12 Thread Nathan Sullivan
Paul, I think you could accomplish this by adding a subquery to your where clause, like: AND NOT EXISTS (SELECT * FROM mappings m where m.src_ip=src_ip) Hope that helps. Nathan On Tue, Oct 12, 2010 at 03:19:36AM -0700, Paul Halliday wrote: I have 2 tables: events and mappings. what I

Re: subquery multiple rows

2010-04-07 Thread Nathan Sullivan
I think you want to do something like this: select prod, group_concat(category separator ', ') from products group by prod; Hope this helps. On Wed, Apr 07, 2010 at 08:37:04AM -0700, kalin m wrote: hi all... i have a bit of a problem with this: table products:

Re: Some MySQL questions

2009-10-08 Thread Nathan Sullivan
On Thu, Oct 08, 2009 at 02:33:34PM -0700, Carlos Proal wrote: On 10/8/2009 4:19 PM, John Oliver wrote: 1) When I select * from whatever; is there a way to have the results go by one screen at a time? You can limit output by delimiting your search ie select * from users limit x,y;

RE: Properly Use Replace Command

2009-07-29 Thread Nathan Sullivan
Carlos, I think this does what you want: (untested though) UPDATE identities SET email=replace(email, 'mail.', '') WHERE email like '%mail.iamghost.com' Regards, Nathan -Original Message- From: Carlos Williams [mailto:carlosw...@gmail.com] Sent: Wednesday, July 29, 2009 1:58 PM To:

RE: Removing Duplicate Records

2009-07-14 Thread Nathan Sullivan
Matt, If you went with option #3, you could avoid the looping by using (tCount - 1) as the LIMIT in the delete statement instead of always using 1. Regards, Nathan -Original Message- From: Matt Neimeyer [mailto:m...@neimeyer.org] Sent: Tuesday, July 14, 2009 8:58 AM To:

RE: Lock timeouts

2009-07-09 Thread Nathan Sullivan
Walton, The table in the select is getting locked for the duration of the query because it is part of the insert statement. I don't know the technical reason for this, but I know it works this way. (having experienced this behavior several times myself) The only way (that I am aware of) to

RE: Adhoc sorting requirement

2009-07-02 Thread Nathan Sullivan
Ravindra, Maybe something like this? order by case when (date_field_1 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 1 when (date_field_2 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 2 when

RE: Adhoc sorting requirement

2009-07-02 Thread Nathan Sullivan
day))) then 2 when (date_field_1 between date(current_timestamp) and date(date_add(current_timestamp, interval 2 day))) then 3 else 4 end, date_field_3, date_field_2, date_field_1; -Original Message- From: Nathan Sullivan Sent: Thursday, July 02, 2009 1:07 PM To: 'Ravindra Harige'; mysql

RE: Update email address domain

2009-06-29 Thread Nathan Sullivan
John, I think this should work: UPDATE members SET email=REPLACE(email, SUBSTRING(email,INSTR(email,'@')+1), 'Thanks_in_advance.com.com') Regards, Nathan -Original Message- From: John Furlong [mailto:john.furl...@rakutenusa.com] Sent: Monday, June 29, 2009 12:54 PM To:

RE: Question about query - can this be done?

2009-06-02 Thread Nathan Sullivan
Ray, You can use the results of a query in a join with something like: select tmp.id, t1.id from (some_query_selecting_id) as tmp join t1 on t1.id=tmp.id Hope that helps. Regards, Nathan Sullivan -Original Message- From: Ray [mailto:r...@stilltech.net] Sent: Tuesday, June 02, 2009

RE: Logging SQL queries

2009-05-27 Thread Nathan Sullivan
Neil, You can turn on the general query log by adding a line like this to your configuration file: log=/var/log/mysql_queries.log Regards, Nathan -Original Message- From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Wednesday, May 27, 2009 9:13 AM To: [MySQL] Subject: