View previous topic :: View next topic
|
Author |
Message |
sandiptcs
New User
Joined: 29 Nov 2006 Posts: 19 Location: amsterdam
|
|
|
|
for the rows that come from the table without timestamp
i would like have spaces in the timestamp
OR
Just curious, is it possible that I have some hardcoded values in them, like 1701200600000000 .... guess it would not be possible |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Sandip,
One solution would be to declare 2 cursors with the ordered-by-date - one for each table.
Then fetch rows from the cursors the same way you would process 2 flat files that you wanted to match. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Like This?
Code: |
SELECT *
FROM SESSION.TMUTATION
;
+---------------------------------------------------+
| BEDRAG | VALUEDATUM | TIMESTAMP |
+---------------------------------------------------+
1_| 300 | 2006-09-27 | 2006-09-27-14.02.26.472344 |
2_| 500 | 2006-12-27 | 2006-12-27-16.32.41.678235 |
3_| 100 | 2007-01-01 | 2007-01-01-09.14.11.924119 |
+---------------------------------------------------+
SELECT *
FROM SESSION.TSUBTOT
;
+----------------------+
| BEDRAG | VALUE_DATE |
+----------------------+
1_| 1000 | 2006-12-12 |
2_| 200 | 2006-11-10 |
3_| 150 | 2007-01-02 |
+----------------------+
SELECT VALUEDATUM AS DT,
BEDRAG AS AMT,
TIMESTAMP AS TS
FROM SESSION.TMUTATION
UNION ALL
SELECT VALUE_DATE AS DT,
BEDRAG AS AMT,
CAST(NULL AS CHAR(26)) AS TS
FROM SESSION.TSUBTOT
ORDER BY DT
;
+---------------------------------------------------+
| DT | AMT | TS |
+---------------------------------------------------+
1_| 2006-09-27 | 300 | 2006-09-27-14.02.26.472344 |
2_| 2006-11-10 | 200 | ? |
3_| 2006-12-12 | 1000 | ? |
4_| 2006-12-27 | 500 | 2006-12-27-16.32.41.678235 |
5_| 2007-01-01 | 100 | 2007-01-01-09.14.11.924119 |
6_| 2007-01-02 | 150 | ? |
+---------------------------------------------------+
SELECT VALUEDATUM AS DT,
BEDRAG AS AMT,
TIMESTAMP AS TS
FROM SESSION.TMUTATION
UNION ALL
SELECT VALUE_DATE AS DT,
BEDRAG AS AMT,
'1701200600000000'
FROM SESSION.TSUBTOT
ORDER BY DT
;
+---------------------------------------------------+
| DT | AMT | TS |
+---------------------------------------------------+
1_| 2006-09-27 | 300 | 2006-09-27-14.02.26.472344 |
2_| 2006-11-10 | 200 | 1701200600000000 |
3_| 2006-12-12 | 1000 | 1701200600000000 |
4_| 2006-12-27 | 500 | 2006-12-27-16.32.41.678235 |
5_| 2007-01-01 | 100 | 2007-01-01-09.14.11.924119 |
6_| 2007-01-02 | 150 | 1701200600000000 |
+---------------------------------------------------+
|
|
|
Back to top |
|
|
|