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]
>
[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:
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
[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
> > EastB
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 wond
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 val
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 O_Se
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 Mes
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 wha
* Peter Sampson
> Maybe it doesn't work because I'm using a SQL wizard in Ultradev, I'll try
> your code in the HTML/ASP part of the webpage
>
> The table structure is
> Month
> Headline
> Image
> Caption
> Content
Peter, you say you're not a programmer, and I'll try to explain a little
about the
- Original Message -
From: "Peter Sampson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 9:06 PM
Subject: Simple SQL
> SQL beginner using Macromedia Ultradev. Can you help?
>
> Please be gentle I'm not a programmer!
>
> I am using
>
> Select DISTINCT Month
>
urhan Ozen <[EMAIL PROTECTED]>
To: Peter Sampson <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 10:14 PM
Subject: RE: Simple SQL
> Peter,
> Please give us more insight on this. Is the column where you store dates
(or
> months) is a date dat
-
From: Gurhan Ozen <[EMAIL PROTECTED]>
To: Peter Sampson <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 10:14 PM
Subject: RE: Simple SQL
> Peter,
> Please give us more insight on this. Is the column where you store dates
(or
> months) is a date datatype
Peter,
Please give us more insight on this. Is the column where you store dates (or
months) is a date datatype column?? If yes you can just do
SELECT ... FROM table_name ORDER BY MONTH(column_name);
It'll help to see your table structure to help you.
Thanks.
Gurhan
-Original Message-
F
* Rodney Broom
> From: Peter Sampson <[EMAIL PROTECTED]>
> > Select DISTINCT Month
> > FROM tblNews
> >
> > The problem is that the months are shown alphabetical not in
> > calendar order.
>
> I'm assuming that your months are stored as names like:
>
> January, February, March
>
> or
>
>
From: Peter Sampson <[EMAIL PROTECTED]>
> Select DISTINCT Month
> FROM tblNews
>
> The problem is that the months are shown alphabetical not in calendar order.
I'm assuming that your months are stored as names like:
January, February, March
or
Jan, Feb, Mar
If so, I think that sorting
At 16:02 17.07.01 +0100, Glenn Wearen wrote:
> > select distinct PersonID
> > from PersonProject
> > where ProjectID != '2';
> >
> > Is this what you are looking for?
>
>
>No, what I'm looking for is...
>SELECT PersonID
>FROM PersonProject
>AND PersonID NOT IN (SELECT PersonID
>
That is exactly what I want, Thanks Rafal
PS: does anybody know if there are plans to support nested queries in mySQL?
> Hi,
> maybe something like this:
> select a.PersonId from PersonProject a left join PersonProject b
> on(a.PersonID=b.PersonID and b.ProjectID=2) where b.PersonID
> is null g
Read all about Join in the manual -- it includes hints like this query:
SELECT DISTINCT(PersonID) FROM PersonProject AS P1
LEFT JOIN PersonProject AS P2 ON P2.PersonID=P1.PersonID AND
P2.ProjectID=2
WHERE P2.PersonID IS NULL;
Cheers,
Kent
> select distinct PersonID
> from PersonProject
> where ProjectID != '2';
>
> Is this what you are looking for?
No, what I'm looking for is...
SELECT PersonID
FROM PersonProject
AND PersonID NOT IN (SELECT PersonID
FROM PersonProjectID
select distinct PersonID
from PersonProject
where ProjectID != '2';
Is this what you are looking for?
Simon
-Original Message-
From: Glenn Wearen [mailto:[EMAIL PROTECTED]]
Sent: 17 July 2001 14:18
To: '[EMAIL PROTECTED]'
Subject: Simple SQL Query?
How can I get a list of all PersonI
On Fri, Jan 26, 2001 at 12:42:51PM +1300, Quentin Bennett wrote:
> Hi,
>
> how about
>
> select fname, c1.cname, c2.cname, c3.cname from
> firms,
> cityname as c1,
> cityname as c2,
> cityname as c3
> where
> first.city0 = c1.id and
> first.city1 = c2.id and
> first.city2 = c3.id;
>
> CC'ing
t you made of it, allowing others, like me, to suggest
other solutions.
Regards
Quentin
-Original Message-
From: Gábor Lénárt [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
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
[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_INCREMEN
25 matches
Mail list logo