Re: complicated query | no Sub query

2005-05-24 Thread Anoop kumar V
Thanks Peter - you gave me some ideas... here is what I have so far (simplified for simplification..) select t2.dt_aud_rec, t1.id_secr_rqst from isr2_aud_log t1, isr2_aud_log t2 where t1.id_secr_rqst=t2.id_secr_rqst and t1.dt_aud_rec t2.dt_aud_rec group by t1.id_secr_rqst but the problem is

Re: complicated query | no Sub query

2005-05-24 Thread SGreen
Anoop kumar V [EMAIL PROTECTED] wrote on 05/24/2005 03:02:11 PM: Thanks Peter - you gave me some ideas... here is what I have so far (simplified for simplification..) select t2.dt_aud_rec, t1.id_secr_rqst from isr2_aud_log t1, isr2_aud_log t2 where t1.id_secr_rqst=t2.id_secr_rqst and

Re: complicated query | no Sub query

2005-05-24 Thread Anoop kumar V
My profound apologies here is the table create structure. the biggest problem i think is that this table does not have any primary keys or atleast unique columns: (I think joins require unique columns) mysql show create table isr2_aud_log\G *** 1. row

RE: complicated query | no Sub query

2005-05-23 Thread Peter Normann
Hi Anoop Try: SELECT t1.id_secr_rqst, t2.name_rec_type, t1.dt_aud_rec FROM isr2_aud_log t1, isr2_aud_log t2 WHERE t1.id_secr_rqst = t2.id_secr_rqst AND t1.name_rec_type='Exception Resource' ORDER by t1.dt_aud_rec DESC LIMIT 2; Peter Normann -- MySQL General Mailing List For list archives:

Re: complicated query | no Sub query

2005-05-23 Thread Anoop kumar V
Thanks Peter - but I see two issues: 1. It returns data about only one id_secr_rqst - I want it to return data about every id_secr_rqst in the table. 2. Limit IMO is mysql specific (I hope I am wrong) is there something generic so I dont need to bother about which database I am running it

RE: complicated query | no Sub query

2005-05-23 Thread Peter Normann
Anoop kumar V mailto:[EMAIL PROTECTED] wrote: 1. It returns data about only one id_secr_rqst - I want it to return data about every id_secr_rqst in the table. So, if I understand you correctly (sorry, having a bad day), you want all records for the past two days? Assuming this, you could use

RE: complicated query | no Sub query

2005-05-23 Thread Peter Normann
Anoop kumar V mailto:[EMAIL PROTECTED] wrote: well - actually it might not be the last 2 days - i just want 2 of the latest records for every task regardless of what date it is in the table. Okay, now I think I understand what you need - and if I am correct, this looks like one of the more

Re: Complicated Query

2005-01-24 Thread Ian Sales (DBA)
Ron Watson wrote: This works, but only if a title and a role exists for the company member. Basically, I want to display the season name from tbl Season, then the show title from tbl Shows, then the roles from cast and titles from production_team for the company member. - use LEFT JOINs. -

Re: Complicated query problem

2004-05-05 Thread beacker
The query as written works just fine although I'm certain there's got to be a more efficient way of doing the same thing. I'm relatively new to MySQL so I took the brute force approach. My problem is that I want to produce totals of each of the columns and can't figure out how to do it. Any

Re: Complicated query. query help

2002-11-13 Thread Roger Baklund
* TimeWalker I've been trying to work out a complicated query to select and sum multiple columns in one select using a condition and multi column group by What I expected to get was ONE row with the columns summed . this query returns 5 rows SELECT

RE: Complicated Query?

2002-01-09 Thread Rick Emery
Needs to be done programmatically -Original Message- From: Jerry Rehak [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: Complicated Query? I have a table with the columns names and id. I want to be able to find all names with an id

RE: Complicated Query?

2002-01-09 Thread Roger Baklund
* Jerry Rehak I have a table with the columns names and id. I want to be able to find all names with an id of '03' that do not have other records with id values of '10','20' or '37'. Is this even possible to do? name id a 03 a 11 a 12 a 13 I want 'a' because

Re: complicated query

2001-04-23 Thread Milo Stefani
try ORDER BY (Category = 'Other'), Category, Subcategory It should work, (I hope ^_-;;;) - Original Message - From: Jeff Shipman - SysProg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 20, 2001 8:38 PM Subject: complicated query I would like to do something similar to an

RE: complicated query

2001-04-20 Thread Braxton Robbason
you want a function that prepends the letter a to the category/subcategory names that are not other. then you order by that function, but do not display it. select category,subcategory from foo2 order by if(category= 'other','zz',concat('a',category)); i.e. everything except other begins with

Re: complicated query

2001-04-20 Thread Steve Werby
"Jeff Shipman - SysProg" [EMAIL PROTECTED] wrote: I would like to do something similar to an ORDER BY in one of my select statements, but I'mt not sure how to do something as complicated as this: I have two columns, category and subcategory, that I am retrieving. I would like category and

Re: complicated query

2001-04-20 Thread Rick Pasotto
On Fri, Apr 20, 2001 at 03:39:59PM -0400, Steve Werby wrote: "Jeff Shipman - SysProg" [EMAIL PROTECTED] wrote: I would like to do something similar to an ORDER BY in one of my select statements, but I'mt not sure how to do something as complicated as this: I have two columns, category

Re: complicated query

2001-04-20 Thread Jeff Shipman - SysProg
} } You don't need to create another column, just use: } } ORDER BY category = 'other', category } Are you sure this works? My query is: select category,subcategory from categories ORDER BY category = 'other', category; And I get: ERROR 1064: You have an error in your SQL syntax near '=

RE: complicated query

2001-04-20 Thread Jeff Shipman - SysProg
This does not work for me. It returns syntax errors. Jeff Shipman E-Mail: [EMAIL PROTECTED] Systems Programmer Phone: (505) 835-5748 NMIMT Computer Center http://www.nmt.edu/~jeff On Fri, 20 Apr 2001, Braxton Robbason wrote: } you want a function that prepends the letter a to

Re: complicated query

2001-04-20 Thread Rick Pasotto
On Fri, Apr 20, 2001 at 03:09:32PM -0600, Jeff Shipman - SysProg wrote: } } You don't need to create another column, just use: } } ORDER BY category = 'other', category } Are you sure this works? My query is: select category,subcategory from categories ORDER BY category = 'other',