Re: [firebird-support] SELECT FIRST N BY GROUP

2019-08-07 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
07.08.2019 14:26, pg...@mccolls.co.uk [firebird-support] wrote:
> Is this possible in a single SELECT query

   I would try WHERE ROW_NUMBER() OVER (PARTITION BY empid, ORDER BY effdate) 
<= 2.


-- 
   WBR, SD.






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



[firebird-support] SELECT FIRST N BY GROUP

2019-08-07 Thread pg...@mccolls.co.uk [firebird-support]
Good day.  I wish to be able to select the n most recent rows by a group.  e.g. 
from the table below I want to select the two most recent salaries for each 
employee ID ordered by effective date for each EMPID
 

 ---
 SALARIES TABLE
 ---
 ID  EMPID  SALARY EFFDATE
 1   25  100 01/04/17 
 2   30  150 01/04/17   
 3   25  200 01/04/18 
 4   30  250 01/04/18 
 5   30  350 01/04/19
 6   22  100 01/04/18
 7   25  300 01/04/19
 

 The result should be
 

 ID  EMPID  SALARY EFFDATE
 6   22  300 01/04/18
 7   25  300 01/04/19
 3   25  200 01/04/18
 5   30  350 01/04/19  
 
 4   30  250 01/04/18
 

 Is this possible in a single SELECT query
 

 regards


Re: [firebird-support] Python Firebird library fdb for web development

2019-08-07 Thread Aldo Caruso aldo.car...@argencasas.com [firebird-support]

Thank you very much for your answer.

Aldo Caruso

El 7/8/19 a las 07:27, 'pcisar' pci...@ibphoenix.cz [firebird-support] 
escribió:

Hi,

The FDB driver has no direct support for either connection pool or 
"persistent connection". However, such functionality is often provided 
by Python web frameworks (for example Django has it), so check your 
options. If it's not provided by framework of your choice, you can use 
3rd party solution like https://pypi.org/project/connection-pool/ (dig 
around on PyPI for others) or write one yourself that fits yout needs.


best regards
Pavel Cisar
IBPhoenix





Re:[firebird-support] Python Firebird library fdb for web development

2019-08-07 Thread 'pcisar' pci...@ibphoenix.cz [firebird-support]
Hi,

The FDB driver has no direct support for either connection pool or "persistent 
connection". However, such functionality is often provided by Python web 
frameworks (for example Django has it), so check your options. If it's not 
provided by framework of your choice, you can use 3rd party solution like 
https://pypi.org/project/connection-pool/ (dig around on PyPI for others) or 
write one yourself that fits yout needs.
 
best regards
Pavel Cisar
IBPhoenix