Re: Help with mysql query, multiple list

2009-05-10 Thread Scott Haneda
What about sub selects. As I see it you only care about the highest and lowest order of results in each list. Sorry, in am on a mobile so I can nit make a test case, and this will be pseudo SQL. Select * from table where start = (select foo) and ( select foo) ... Also look at the between

Re: Help with mysql query, multiple list

2009-05-09 Thread Simon J Mudd
abhishek@gmail.com (Abhishek Pratap) writes: I am kind of stuck with this query , cant expand my thinking. May this is a limitation. Here it is I have a database with many cols two of which are start and end position for an event. Now I have a list of event time stamps, I want to

Help with mysql query, multiple list

2009-05-08 Thread Abhishek Pratap
Hi All I am kind of stuck with this query , cant expand my thinking. May this is a limitation. Here it is I have a database with many cols two of which are start and end position for an event. Now I have a list of event time stamps, I want to find all the info once the current event time

Re: Help with mysql query, multiple list

2009-05-08 Thread Abhishek Pratap
aah okie I think I was trying to get too clever. Guess that won't work ... Thanks, -Abhi On Fri, May 8, 2009 at 12:34 PM, Barney Boisvert bboisv...@gmail.comwrote: You'll have to iterate over your two lists of timestamps and build a set of ORed conditional pairs: sql = select ... from ...

Re: Help with mysql query, multiple list

2009-05-08 Thread Jim Lyons
why not something like below. Assume you have 3 pairs of start/end timestamps and you want to find everything within those 3 time periods: select * from table_name where start = start1 and end = end1 union select * from table_name where start = start2 and end = end2 union select * from

Re: Help with mysql query, multiple list

2009-05-08 Thread Abhishek Pratap
Hi Jim Unfortunately I have thousands of such points. So explicit statement calling will be very expensive both computationally and in terms of writing.. Thanks, -Abhi On Fri, May 8, 2009 at 12:37 PM, Jim Lyons jlyons4...@gmail.com wrote: why not something like below. Assume you have 3 pairs

Re: Help with mysql query, multiple list

2009-05-08 Thread Kyong Kim
Abhi, I might not be understanding the problem but could you use the max and min timestamp values and use something like SELECT * FROM TABLE WHERE start BETWEEN max AND min AND end BETWEEN max AND min or SELECT * FROM TABLE WHERE START IN (1,2,3,4,5) AND END IN(1,2,3,4,5) I might be

Re: Help with mysql query, multiple list

2009-05-08 Thread Jim Lyons
then either build the statement by way of a program like a perl script or select all records with a start time after the min start time of all in your list and an end time less than the max end time in your list then filter them further either in a program or a store procedure. On Fri, May 8,