select hour(timefield) as 'f1' from table1 group by f1

Ivan Smahin ivan_smahin at paradigmasoft.com
Fri Oct 19 01:44:58 CDT 2007


Hello Joseph,

Friday, October 19, 2007, 4:14:35 AM, you wrote:

> On Oct 18, 2007, at 2:28 AM, Ivan Smahin wrote:

>> Now you want:
>> select f1 from (select hour(f2) as 'f1' from t1) group by f1
>>
>> But you can create a method instead:
>>
>> alter table t1 add column m1 long method('month(f2)')
>>
>> And now you can:
>> Select m1 from t1 group by m1


> Wow!
> That really speeded things up!
Good to hear :)

> Also, I have always just been doing generic sql selects.
> I never tampered with stored procedures and the like. Are
> methods the same or similar to stored procedures?

The  methods, triggers  are  similar to SPs in some sense.
They are all consist of some set of sql statement.

> Maybe
> this will shorten up all the complex selects?

Yes, using methods you can simplify the queries a lot.



-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list