Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Anybody? Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sorry, I forgot to mention I am using version 4.0.20a (no subqueries supported) Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a simple problem and I'm just wondering the BEST

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] Anybody? I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value exists more than once in that table. IE... MyTable Region(foreign key)City EastBaltimore

Re: Simple SQL Question

2004-10-27 Thread gerald_clark
What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city Jay Blanchard wrote: [snip] Anybody? I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city [/snip] Crud! Standing too close to the forest and forgot about a self join... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Good one. I don't know how I missed this either! Thanks! gerald_clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city Jay Blanchard wrote: [snip] Anybody? I

Re: Simple SQL Question

2004-10-22 Thread Jeff Burgoon
Sorry, I forgot to mention I am using version 4.0.20a (no subqueries supported) Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value

Re: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Keith C. Ivey
On 16 Jul 2002, at 21:39, Robo wrote: I want the latest (highest) iSession to be selected: SELECT iSession FROM O_Sessions GROUP BY iUser Because of GROUP BY, allways the first(!) recordset for iUser is selected. But i want the last recordset to be selected :-( I'm not sure what you

RE: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Satish Prabhu
Well if you want the latest and greatest iSession irrespective of the user use select max(iSession) from O_Sessions; If it is to be grouped by user, then select user, max(iSession) from O_Sessions group by user; This will give you the max iSession for a user. Regards Satish -Original

Re: ??? Simple sql-question: SELECT iSession FROM O_Sessions GROUP BY iUser

2002-07-16 Thread Mike
Have you tried something like this, SELECT iSession FROM O_Sessions GROUP BY iUser ORDER BY iSessions DESC; Mike - Original Message - From: Robo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 16, 2002 3:39 PM Subject: ??? Simple sql-question: SELECT iSession FROM

Re: simple SQL question

2001-01-25 Thread Gerald L. Clark
[EMAIL PROTECTED] wrote: Hi, Sorry for the possible offtopic question I'm going to ask. I have got something similar (this is very simplicated situation of my problem but this is the core of my headache): CREATE TABLE cityname ( id BIGINT NOT NULL AUTO_INCREMENT,

Re: simple SQL question

2001-01-25 Thread Gábor Lénárt
On Thu, Jan 25, 2001 at 12:52:11PM -0600, Gerald L. Clark wrote: I would suggest not having 2 cities in your firm record, and making fname,city your key. select * from firms order by fname,city would give you. A+B company Dallas A+B company London New systems Ltd New York New

RE: simple SQL question

2001-01-25 Thread Quentin Bennett
made of it, allowing others, like me, to suggest other solutions. Regards Quentin -Original Message- From: Gbor Lnrt [mailto:[EMAIL PROTECTED]] Sent: Friday, 26 January 2001 09:20 To: Gerald L. Clark Cc: [EMAIL PROTECTED] Subject: Re: simple SQL question On Thu, Jan 25, 2001 at 12:52:11PM