select hour(timefield) as 'f1' from table1 group by f1
Joseph Morgan
joseph at checkos.com
Wed Oct 17 16:35:35 CDT 2007
On Oct 17, 2007, at 12:18 PM, Ivan Smahin wrote:
> Wednesday, October 17, 2007, 4:35:54 PM, you wrote:
>
>> On Oct 17, 2007, at 8:33 AM, Ivan Smahin wrote:
>
>>> Could you report it to Mantis please?
>>>
>>> Workaround:
>>> Add field-method to the table table1. Method text
>>> is -
>>> hour(timeField).
>>>
>>> Now your query will look like this:
>>> select m1 from table1 group by m1
>
>
>> Ok but I find that this works so I'll use this:
>
>> select f1 from (select hour(timefield) as 'f1' from table1) group
>> by f1
>
>
> Yes, it could be solved in this way.
> But there is some overhead which can be completely avoided.
>
> Look - each time you are asking for preparing some tmp table
> (subquery)
> and indexing f1 field of that tmp table to get some groups. And,
> finally,
> destroy all that objects.
>
> Having indexed method you are free of such charges. The price is only
> index maintenance on each data modification.
>
> Subquery could be solution for rare queries, but personally, I think
> the method is better approach anyway. (I don't think we are speaking
> about heavy OLTP app. here)
>
> So it is up to you which way you choose. :)
Well I am not familiar at all with methods. How do I go about
creating and storing a method. Does the method stay permanently
on the database? Is there some documentation on creating methods?
Also, I am using realbasic, does that effect how I go about it?
Thanks,
Joseph
More information about the Valentina
mailing list