Hey Vasile:
Cause I have more clauses based on the stock table that I haven't
included in the original query. For example:
SELECT
date, count(items)
FROM
(
SELECT
logs.date, logs.items
FROM logs
WHERE
extract(year from logs.date) = 2010)
GROUP BY date, items
) AS foo,
hing is selected from the stock
> table.
>
>
>
>
>
> On Jan 28, 2:16 pm, "beto (R3)" wrote:
>> Hey guys:
>>
>> Is there a way to do this query in DAL?
>>
>> SELECT
>> date, count(foo.items)
>> FROM
>> (
>> SE
Postgres too!
On Fri, Jan 28, 2011 at 1:41 PM, villas wrote:
>> It seems to work in SQLite and MS-SQL though.
>
> Firebird seems OK too.
>
>
Hey Vasile:
The end select would give an error.. belongs() translates to a:
" db.logs.item IN ( SELECT db.logs.date, db.logs.item [..] )"
"ERROR: subquery has too many columns"
If the tables had id fields this technique could actually work tho...
thanks!
beto
On Sat, Jan 29, 2011 at 4:13 AM
Hey:
Nope.. that won't work.. that puts everything in a single query.. The
reason I'm doing SELECT ... FROM ( SELECT.. GROUP BY ..) is to get rid
of multiple items in the same day. That's why I group by date, items
and then group by date.
If I could do a count(distinct(items)) I could do that in
Hey Vasile:
Thanks for your answer.. yes.. that I know and that's actually what
I'm doing.. but I'd like to use the benefits of doing it with DAL.
(cache the queries, security validation for parameters, etc).
regards.
On Fri, Jan 28, 2011 at 7:18 PM, Vasile Ermicioi wrote:
> you always can exec
Hey guys:
Is there a way to do this query in DAL?
SELECT
date, count(foo.items)
FROM
(
SELECT
logs.date, logs.items
FROM logs
WHERE
extract(year from logs.date) = 2010)
GROUP BY date, items
) AS foo, stock
WHERE
stock.items = foo.items
GROUP by date
Any he
7 matches
Mail list logo