RE: Can this be done with a single query?

2010-10-12 Thread Daevid Vincent
NG source_ip BETWEEN '10.0.0.0' and '10.255.255.255' But yeah, Travis suggestion is cleaner and more efficient. > -Original Message- > From: Travis Ard [mailto:travis_...@hotmail.com] > Sent: Tuesday, October 12, 2010 9:51 AM > To: 'Paul Halliday' >

RE: Can this be done with a single query?

2010-10-12 Thread Travis Ard
2301055 AND m.src_ip IS NULL; -Travis -Original Message- From: Paul Halliday [mailto:paul.halli...@gmail.com] Sent: Tuesday, October 12, 2010 10:08 AM To: Johnny Withers Cc: mysql@lists.mysql.com Subject: Re: Can this be done with a single query? On Tue, Oct 12, 2010 at 11:14 AM, Johnny

Re: Can this be done with a single query?

2010-10-12 Thread Paul Halliday
On Tue, Oct 12, 2010 at 11:14 AM, Johnny Withers wrote: > I would try: > > SELECT DISTINCT(e.src_ip) > FROM event AS e > LEFT JOIN mappings AS m ON e.src_ip=m.src_ip > WHERE e.timestamp BETWEEN '2010-10-11 00:00:00' AND '2010-10-12 00:00:00' > AND INET_NTOA(e.src_ip) NOT LIKE '10.%.%.%' > AND INE

Re: Can this be done with a single query?

2010-10-12 Thread Johnny Withers
I would try: SELECT DISTINCT(e.src_ip) FROM event AS e LEFT JOIN mappings AS m ON e.src_ip=m.src_ip WHERE e.timestamp BETWEEN '2010-10-11 00:00:00' AND '2010-10-12 00:00:00' AND INET_NTOA(e.src_ip) NOT LIKE '10.%.%.%' AND INET_NTOA(e.src_ip) NOT LIKE '172.16.%.%' AND INET_NTOA(e.src_ip) NOT LIKE '

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

Can this be done with a single query?

2010-10-12 Thread Paul Halliday
I have 2 tables: events and mappings. what I want to do is something like: SELECT DISTINCT(src_ip) FROM event WHERE timestamp BETWEEN '2010-10-11 00:00:00' AND '2010-10-12 00:00:00' AND INET_NTOA(src_ip) NOT LIKE '10.%.%.%' AND INET_NTOA(src_ip) NOT LIKE '172.16.%.%' AND INET_NTOA(src_ip) NOT LIK

[solved]Re: Question about query - can this be done?

2009-06-02 Thread Ray
s, > Nathan Sullivan Thanks Nathan, I think that completes the picture. Just what I was looking for. Ray > > -Original Message- > From: Ray [mailto:r...@stilltech.net] > Sent: Tuesday, June 02, 2009 4:58 PM > To: mysql@lists.mysql.com > Subject: Re: Question about query -

RE: Question about query - can this be done?

2009-06-02 Thread Nathan Sullivan
4:58 PM To: mysql@lists.mysql.com Subject: Re: Question about query - can this be done? On June 2, 2009 03:14:36 pm Ray wrote: > On June 2, 2009 10:44:48 am Peter Brawley wrote: > > Ray, > > > > >I want a query that will provide one record per event with all times >

Re: Question about query - can this be done?

2009-06-02 Thread Ray
On June 2, 2009 03:14:36 pm Ray wrote: > On June 2, 2009 10:44:48 am Peter Brawley wrote: > > Ray, > > > > >I want a query that will provide one record per event with all times > > > included. feel free to answer RTFM or STFW as long as you provide the > > > manual section or key words. ;) > > >

Re: Question about query - can this be done?

2009-06-02 Thread Ray
On June 2, 2009 10:44:48 am Peter Brawley wrote: > Ray, > > >I want a query that will provide one record per event with all times > > included. feel free to answer RTFM or STFW as long as you provide the > > manual section or key words. ;) > > Can be done with a pivot table. Examples under "Pivot

Re: Question about query - can this be done?

2009-06-02 Thread Peter Brawley
Ray, I want a query that will provide one record per event with all times included. feel free to answer RTFM or STFW as long as you provide the manual section or key words. ;) Can be done with a pivot table. Examples under "Pivot tables" at http://www.artfulsoftware.com/infotree/queries.p

Re: Question about query - can this be done?

2009-06-02 Thread Brent Baisley
On Tue, Jun 2, 2009 at 11:52 AM, Ray wrote: > Hello, > > I've tried the manual and google, but I am not even sure what to call what I > want to do. > > simplified data example: > I have a table of start and end times for an event, and an id for that event > in a table. each event may occur multipl

Question about query - can this be done?

2009-06-02 Thread Ray
Hello, I've tried the manual and google, but I am not even sure what to call what I want to do. simplified data example: I have a table of start and end times for an event, and an id for that event in a table. each event may occur multiple times, but never more than 5 times and rarely more th

Can this be done without UNION?

2002-07-03 Thread von Boehn, Gunnar
Hi all, I have a problem whith a very simple query. My problem is: it doesn't use indexes. It does full table scans instead. The only way I found to make it fast was using UNION. Can somebody please tell me, how I can make it fast (using indexes) without using UNION? My query: SELECT * FROM

Re: SQL question -- can this be done?

2002-03-09 Thread Jeff Kilbride
t; Sent: Saturday, March 09, 2002 1:26 PM Subject: Re: SQL question -- can this be done? > I asked almost the exact same question just a few days ago. > > As of MySQL 3.23.2 you can use COUNT and DISTINCT together: > > SELECT COUNT(DISTINCT ipAddress) ... > > On 9/3/02 at 1:1

Re: SQL question -- can this be done? FOUND IT!

2002-03-09 Thread Jeff Kilbride
y...) Thanks, --jeff - Original Message - From: "Jeff Kilbride" <[EMAIL PROTECTED]> To: "MySQL" <[EMAIL PROTECTED]> Sent: Saturday, March 09, 2002 1:16 PM Subject: SQL question -- can this be done? > I have a table with 3 fields: > > initDate dateti

Re: SQL question -- can this be done?

2002-03-09 Thread Rob
I asked almost the exact same question just a few days ago. As of MySQL 3.23.2 you can use COUNT and DISTINCT together: SELECT COUNT(DISTINCT ipAddress) ... On 9/3/02 at 1:16 pm, Jeff Kilbride <[EMAIL PROTECTED]> wrote: > I have a table with 3 fields: > > initDate datetime not null > id int u

SQL question -- can this be done?

2002-03-09 Thread Jeff Kilbride
I have a table with 3 fields: initDate datetime not null id int unsigned not null ipAddress int unsigned not null I'm trying to find the number of distinct ipAddresses associated with a particular id over a specified time frame -- for simplicity, let's say the time frame is the last 60 minutes.

RE: Can this be done?

2002-02-13 Thread Rick Emery
What do your tables look like? Structure? What are you trying to do? What does your data look like? -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 10, 2002 8:12 PM To: [EMAIL PROTECTED] Subject: Can this be done? I'm trying to update a dat

Can this be done?

2002-02-12 Thread Egor Egorov
Ed, Monday, February 11, 2002, 4:12:13 AM, you wrote: EL> I'm trying to update a database. Here's the query that's not working. Is EL> there another way of doing it or is this impossible with MySQL? EL> Thanks, EL> -Ed EL> update SiteIndex EL> set EL> SiteIndex.Visi

Can this be done?

2002-02-12 Thread Ed Lazor
I'm trying to update a database. Here's the query that's not working. Is there another way of doing it or is this impossible with MySQL? Thanks, -Ed update SiteIndex set SiteIndex.Visitors = Pages.Visitors where SiteIndex.Title = Documents.Titl

Can this be done?

2002-02-10 Thread Ed Lazor
I'm trying to update a database. Here's the query that's not working. Is there another way of doing it or is this impossible with MySQL? Thanks, -Ed update SiteIndex set SiteIndex.Visitors = Pages.Visitors where SiteIndex.Title = Documents.Titl

Re: Can this be done?

2001-12-08 Thread Steve Edberg
How about UPDATE myTable SET DueField = 0, StatusField = if(StatusField='O', 'C', StatusField) WHERE PrimaryKeyField = 'XYZXYZ' See http://www.mysql.com/doc/C/o/Control_flow_functions.html for more info on IF() function. -steve At 12:41 P

RE: Can this be done?

2001-12-07 Thread Johnson, Gregert
UPDATE myTable SET DueField = 0, StatusField = IF(StatusField = 'O', 'C', StatusField) WHERE PrimaryKeyField = "XYZXYZ"; -- Greg Johnson -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED]] Sent: Friday, December 07, 2001 1:42 PM To: [EMAIL P

Can this be done?

2001-12-07 Thread Chris Boget
Is there a way to do this? If so, I've not been able to find it in the documentation... I have 3 fields: PrimaryKeyField StatusField DueField I want to update the DueField to 0 (zero) where the PrimaryKeyField = "XYZXYZ". I also want to update the StatusField for those records to be equal to