Actually, there is a "hackier" way, but I advise strongly not to
follow this path.
Psyco-maniac query that returns the same result (this is working on
Postgresql, on MSSQL || must be replaced with +, on mysql there is the
CONCAT function for that, but I don't have mysql installed to test it)
Post
Once defined that you want a recordset that is the result of a join
between the two tables, with all the fields of the two tables and
containing only the records having the maximum start date, I think
that the right query for the job is
select curve.*, site.*
from curve
inner join
(
select max("st
can you write the raw SQL for what you want to do? sounds like you need to
do a sub-query with it's own grouping so that you can get the max start
value, and then join those results into your outer query where you can group
by something different.
if you can write the SQL then we'll be certain
Hi!
again about this old question... I tried to work around this not so easy
problem but I always came back to it.
the solution proposed by howesc runs but not resolves my needs. Now
suppose I need to extract another value of the curve record
corresponding to the max start value... how can I
not sure about the web2py translation (that would take me some time to
figure out since i have not done much grouping in web2py), but:
SELECT * FROM (SELECT * FROM power_curve ORDER BY start DESC) AS TMP
GROUP BY site;
is not valid. i'm surprised that it works on mysql server. every column
t
On 26/07/2011 11:18, Manuele Pesenti wrote:
can you help me to translate this sql query that correctly runs under my
mysql server?
maybe it's better to say what here is needed... suppose to have the
subsequent model:
db.define_table('site',
Field('name'),
...
)
db.define_table('curv
6 matches
Mail list logo