ODP: Re: [firebird-support] How to add previous column value to current value?

2016-04-04 Thread Piotr Olszewski piotr.olszew...@eskrzynka.pl [firebird-support]
I can't. sql is generated dynamicly 

Wysłano ze smartfonu Sony Xperia™

 Użytkownik Michal Kurczabinski michk...@gmail.com [firebird-support] 
napisał 

>  
>
>Try this:
>
>select t.name, t.data, coalesce(t.data -(select data from t1 d where d.id = 
>t.id -1),0) from t1 t
>
>-- 
>regards,
>Michał Kurczabiński
>
>
>
>
> 

RE: [firebird-support] How to add previous column value to current value?

2016-03-29 Thread 'Piotr Olszewski' piotr.olszew...@eskrzynka.pl [firebird-support]
let's assume that I have 2.5.3

Pozdrawiam

Piotr Olszewski

-Original Message-
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] 
Sent: Tuesday, March 29, 2016 11:45 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How to add previous column value to current
value?

29.03.2016 11:40, 'Piotr Olszewski' piotr.olszew...@eskrzynka.pl
[firebird-support] wrote:
> I need to get a date difference (days between) between rows.

   With Firebird 3.0 you can use window function LAG.

-- 
   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





[firebird-support] How to add previous column value to current value?

2016-03-29 Thread 'Piotr Olszewski' piotr.olszew...@eskrzynka.pl [firebird-support]
Hi

 

 

I need to get a date difference (days between) between rows.

 

Let say i have:

 

Name   Date

---

Name1 date1

Name2 date2

Name3 date3

 

Order by date

 

I need something like this

 

Name   Date  Days betwen Previous date

--

Name1 date10

Name2 date2date2-date1

Name3 date3date3-date2

 

 

sql is generated dynamically and it's quite complicated so i can't use
procedure to do this.

 

 

 

Regards

 

Piotr Olszewski

 



ODP: Re: [firebird-support] Subquery and returning 0

2014-07-12 Thread Piotr Olszewski piotr.olszew...@eskrzynka.pl [firebird-support]
Hej

Jak poprzednicy do końca nie wiem o co Ci chodzi. Może zamiast case when 
wykorzystaj funkcję 
COALESCE, która zwraca pierwsza wartość nie Null. 

Chyba ze po prostu zapytanie nie zwraca Ci żadnych pozycji wówczas będziesz 
miał zawsze null. 

Jeśli Ci nie za bardzo pomogłem lub potrzebujesz więcej info wal śmiało na tego 
maila

Pozdrawiam 

Piotr 
Wysłano ze smartfonu Sony Xperia™

 Użytkownik Łukasz Bączek bacze...@o2.pl [firebird-support] napisał 

  

W dniu 12.07.2014 16:01, Mark Rotteveel m...@lawinegevaar.nl 
[firebird-support] pisze:

  

On 12-7-2014 15:57, Łukasz Bączek bacze...@o2.pl [firebird-support] wrote:
 Hello,
 I have a SQL query:


 SELECT
 CASE WHEN umowy.numer_umowy IS NULL THEN 0 END AS numer_umowy
 FROM umowy
 WHERE umowy.data_podpisania IS NOT NULL AND umowy.id_wnioski IN
 (SELECT CASE WHEN wnioski.id_wnioski IS NULL THEN 0 END AS id_wnioski
 FROM wnioski
 LEFT JOIN kategorie_wnioskow ON
 kategorie_wnioskow.id_kategorie_wnioskow=wnioski.id_kategorie_wnioskow
 WHERE kategorie_wnioskow.id_kategorie_wnioskow_typ=1) AND umowy.rok=2014

 How do I stop if NUMER_UMOWY is NULL is returned to 0 and not null

I have read this question multiple times, but I don't understand what 
you mean. Could you give an example of data and the result you want to have?

After this query I have the result: 

UMOWY.NUMER_UMOWY = NULL 

It needs to 

UMOWY.NUMER_UMOWY = 0 



!-- #ygrp-mkp { border: 1px solid #d8d8d8; font-family: Arial; margin: 10px 
0; padding: 0 10px; } #ygrp-mkp hr { border: 1px solid #d8d8d8; } #ygrp-mkp 
#hd { color: #628c2a; font-size: 85%; font-weight: 700; line-height: 122%; 
margin: 10px 0; } #ygrp-mkp #ads { margin-bottom: 10px; } #ygrp-mkp .ad { 
padding: 0 0; } #ygrp-mkp .ad p { margin: 0; } #ygrp-mkp .ad a { color: 
#ff; text-decoration: none; } #ygrp-sponsor #ygrp-lc { font-family: Arial; 
} #ygrp-sponsor #ygrp-lc #hd { margin: 10px 0px; font-weight: 700; font-size: 
78%; line-height: 122%; } #ygrp-sponsor #ygrp-lc .ad { margin-bottom: 10px; 
padding: 0 0; } #actions { font-family: Verdana; font-size: 11px; padding: 
10px 0; } #activity { background-color: #e0ecee; float: left; font-family: 
Verdana; font-size: 10px; padding: 10px; } #activity span { font-weight: 700; 
} #activity span:first-child { text-transform: uppercase; } #activity span a { 
color: #5085b6; text-decoration: none; } #activity span span { color: #ff7900; 
} #activity span .underline { text-decoration: underline; } .attach { clear: 
both; display: table; font-family: Arial; font-size: 12px; padding: 10px 0; 
width: 400px; } .attach div a { text-decoration: none; } .attach img { border: 
none; padding-right: 5px; } .attach label { display: block; margin-bottom: 
5px; } .attach label a { text-decoration: none; } blockquote { margin: 0 0 0 
4px; } .bold { font-family: Arial; font-size: 13px; font-weight: 700; } .bold 
a { text-decoration: none; } dd.last p a { font-family: Verdana; font-weight: 
700; } dd.last p span { margin-right: 10px; font-family: Verdana; font-weight: 
700; } dd.last p span.yshortcuts { margin-right: 0; } div.attach-table div div 
a { text-decoration: none; } div.attach-table { width: 400px; } div.file-title 
a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited { 
text-decoration: none; } div.photo-title a, div.photo-title a:active, 
div.photo-title a:hover, div.photo-title a:visited { text-decoration: none; } 
div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts { font-family: Verdana; 
font-size: 10px; font-weight: normal; } .green { color: #628c2a; } .MsoNormal 
{ margin: 0 0 0 0; } o { font-size: 0; } #photos div { float: left; width: 
72px; } #photos div div { border: 1px solid #66; height: 62px; overflow: 
hidden; width: 62px; } #photos div label { color: #66; font-size: 10px; 
overflow: hidden; text-align: center; white-space: nowrap; width: 64px; } 
#reco-category { font-size: 77%; } #reco-desc { font-size: 77%; } .replbq { 
margin: 4px; } #ygrp-actbar div a:first-child { /* border-right: 0px solid 
#000;*/ margin-right: 2px; padding-right: 5px; } #ygrp-mlmsg { font-size: 
13px; font-family: Arial, helvetica,clean, sans-serif; *font-size: small; 
*font: x-small; } #ygrp-mlmsg table { font-size: inherit; font: 100%; } 
#ygrp-mlmsg select, input, textarea { font: 99% Arial, Helvetica, clean, 
sans-serif; } #ygrp-mlmsg pre, code { font:115% monospace; *font-size:100%; } 
#ygrp-mlmsg * { line-height: 1.22em; } #ygrp-mlmsg #logo { padding-bottom: 
10px; } #ygrp-msg p a { font-family: Verdana; } #ygrp-msg p#attach-count span 
{ color: #1E66AE; font-weight: 700; } #ygrp-reco #reco-head { color: #ff7900; 
font-weight: 700; } #ygrp-reco { margin-bottom: 20px; padding: 0px; } 
#ygrp-sponsor #ov li a { font-size: 130%; text-decoration: none; } 
#ygrp-sponsor #ov li { font-size: 77%; list-style-type: square; padding: 6px 
0; } #ygrp-sponsor #ov ul { margin: 0; padding: 0 0 0 8px; } #ygrp-text { 
font-family: Georgia; } #ygrp-text p { margin: 0 0 1em 0;