Hi,
I have a table and I'd like to do a SELECT query with the result ordered by
the minimum of two fields. I might also like to query by the minimum (but
that is an easier problem, as I can just rephrase it as an OR).
Can I just write something like:
SELECT * FROM mytable WHERE fieldofinterest
Michael
The subquery version of that logic
SELECT * FROM a
JOIN b ON a.id = b.a_id
WHERE b.id = (
SELECT MAX(c.id)
FROM b as c
WHERE c.a_id = a.id
);
likely runs slower. If the sorting column is also the joining column,
you can still write it as a join:
SELECT a.*, b.*
FROM a INNER JO
> insert into user (user,host) values ('jeff','localhost');
> flush privileges;
> grant all on databaseName.* to jeff;
jeff = [EMAIL PROTECTED]
not [EMAIL PROTECTED]
So in your statement you should have used...
grant all on databaseName.* to [EMAIL PROTECTED];
>select user,host from
Peter,
Thanks for the reply. I was not able to get your query working as
illustrated. I also realize that my example query was flawed, as I made
no reference to an ordering column (as you point out). What I was able
to get working is the following:
SELECT
*
FROM
a
JOIN
b
ON
a.id = b.
Hi,
MySQL 5.0.24, a new version of the popular Open Source Database
Management System, has been released. The Community Edition is now
available in source and binary form for a number of platforms from our
download pages at
http://dev.mysql.com/downloads/ and mirror sites.
Note that not
Michael,
>If I wanted all records from "a" and only the first record from "b",
>how would I integrate a LIMIT statement in this, or some other
>statement that would achieve the same end? Appending LIMIT
>to the end of the query will limit the entire result set, which is not
>the desired effect.
I'm apologize for posting an apparently simple question, but I'm stuck. I'm
trying to get my java application to connect to mysql on the same server.
The server is redhat with mysql 5.1.11. I'd done this with mysql 4.x in the
distant past.
I add a user with the command:
insert into user (user
Hi there,
I'm following up on a thread I started yesterday with a new thread,
cause I'm now looking at a different problem: limiting the result of a
join. For example:
SELECT
*
FROM
a
JOIN
b
ON
a.id = b.id
If I wanted all records from "a" and only the first record from "b", how
wo
Hi,
Can anyone on this list tell me _how_ i can connect to my MySQL-5.0.22
server running on Windows-XP-SP2 using OpenVPN on Windows? It looks
like a good VPN/SSL implementation.
--
Thanks in advance,
Asif
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubs