I have two rows in same table named Test having the metadata :
ref_col , type_taux, type_tans, date_trans, date_val
row 1 : 1011 , 'FIXE', 'Pay', '22092022', '23092022'
row 2 : 1011 , 'Variable', 'Receive', '22092022', '23092022'
The result should be :
ref_col , type_taux_pay, type_tans_pay, date_trans, date_val, type_taux_receive, type_tans_receive
1011 , 'FIXE', 'Pay', '22092022', '23092022', 'Variable', 'Receive'
In other word, I should keep common variables and add different ones in the same ligne because they have '1011' as same reference
How can I do that in hql ? thanks
Related
I have a set of 5 tables that have 2 millions rows and 450 columns approximately
My job look like this :
tDBInput 1 ---tMap-----
tDBInput 1 ---tMap-----
tDBInput 1 ---tMap---tUnite---tDBOutput
tDBInput 1 ---tMap-----
tDBInput 1 ---tMap-----
It's my 5 tables tables that I'm trying to union, with the tMap where I'm adding an Id to trace which table date come from + reduce number of columns (from 450 to 20)
Then I unite the 5 in one tUnite that load a table in Truncate - Insert mode
I'm trying to make it work but always have the same error which is "The code of method tDBInput-10Process is exceeding the 65535 bytes limit"
If you use only 20 of 450 columns, you could select only those columns in each of your tDBInput, instead of extracting all columns and filtering them in tMap.
For data like below
Col1
----
1
23
34
124
Output should be like below
Out
1
2
3
4
I tried the below hierarchical query but its giving repeated data
select substr(col1, level, 1)
from table1
connect by level <= length(col1);
I can't use distinct as this is sample and main table where I have to use this query has quite large data.
Thanks
folks,
H2 skips/drops the FIRST line of the following csv-Dataset ...
and I couldn't find a solution or workaround.
I have already looked through the various H2-tutorials and of course skimmed
the internet ...
Am I the only one (newbie - my "home" is the IBM-Mainframe)
who has such a problem inserting into a H2-database by using CSVREAD?
I expected here in this example the CSVREAD-Utility to insert 5(five!) lines
into the created table "VL01T098".
!!! there is no "Column-Header-Line" in the csv-dataset - I get the data this way only !!!
AJ52B1;999;2013-01-04;2014-03-01;03Z;A
AJ52C1;777;2012-09-03;2012-08-19;03Z;
AJ52B1;;2013-01-04;2014-03-01;;X
AJ52B1;321;2014-05-12;;03Z;Y
AJ52B1;999;;2014-03-01;03Z;Z
And here is my SQL (from the H2-joboutput):
DROP TABLE IF EXISTS VL01T098;
Update count: 0
(0 ms)
CREATE TABLE VL01T098 (
MODELL CHAR(6)
, FZG_STAT CHAR(3)
, ABGABE_DATUM DATE
, VERSAND_DATUM DATE
, FZG_GRUPPE CHAR(3)
, AV_KZ CHAR(1))
AS SELECT * FROM
CSVREAD
('D:\VL01D_Test\LOAD-csv\T098.csv',
null,
'charset=UTF-8 fieldSeparator=; lineComment=#');
COMMIT;
select count(*) from VL01T098;
select * from VL01T098;
MODELL FZG_STAT ABGABE_DATUM VERSAND_DATUM FZG_GRUPPE AV_KZ
AJ52C1 777 2012-09-03 2012-08-19 03Z null
AJ52B1 null 2013-01-04 2014-03-01 null X
AJ52B1 321 2014-05-12 null 03Z Y
AJ52B1 999 null 2014-03-01 03Z Z
(4 rows, 0 ms)
? Where is just the first csv-line gone ... and why is it lost?
Could you please help a H2-newbie ... with some IBM-DB2-experience
Many thanks in advance
Achim
You didn't specify a column list in the CSVREAD function. That means the column list is read from the file, as documented:
If the column names are specified (a list of column names separated
with the fieldSeparator), those are used, otherwise (or if they are
set to NULL) the first line of the file is interpreted as the column
names.
I have two tables f and t
f table is
one : two : three
1 dk jkdk
179 dsa ppd
90 dsj dat
t table is
one : two : three
0 100 aus
191 200 NZ
I want to compare f.one value with values t.one and t.two and get return t.three
For example,
if f.one == 90 then value should be aus
expected output:
t.three
aus
NZ
aus
I tried like :
select t.three from t JOIN (select f.one from f) y where y.one>=t.one AND y.one<=t.two;
and got output as:
aus
aus
Nz
you are doing it right the problem is that the result don't keep the order of table t and that's why it seems mixed.
Change the select to t.one,t.three and you'll see its fine.
if the order really matters you can add order by t.one in the end
How to write formula to get data from two tables linked together by one column
Hi ,
I am new to crystal report. I have a problem to create formula :
Let's say :
I have two tables :
tbl_Details :
Emp_id Emp_nameEmp_Deptt
1 Ram MMM
2 Naresh NNN
3 kapil HHH
4 Namita DDD
tbl_Mapping :
Col_1 Col_2 Emp_Deptt
ButterSotch ButterScotch NNN
ButterScotch Strawberry DDD
Olive Starch MMM
Olive Olive HHH
Note : In the above tables, Emp_Deptt column is same.
Now i want to create a formula like as below :
if Mapping.Type1 = Mapping.Type2 then find Emp_Deptt in Details table and get the Emp_name.
for example :
Butterscotch = Butterscotch then Emp_Deptt is NNN matched with Details table and the Emp_name is Naresh.
if doesn't find any match then nothing to do.
Now, i want to create a formula to get the desired value and print place somewhere in crystal report.
you need to make view of the tables first, join the the two tables, tbl_Deetails with tbl_Mapping..
link them with the department ID.. once its done, call that view to the report and use the formula like this
if(totext({view.Type1}) == totext({view.Type2})) then
(
{view.Employee_Name};
)
else
(
//nothing
)