with your select I got an error message:
db2 => WITH TEMPTABLE (parent,name) AS (SELECT parent,name FROM test WHERE id = 4 UNION ALL SELECT X.parent,X.name FROM test X, TEMPTABLE Y WHERE Y.name = X.parent) SELECT name FROM TEMPTABLE
SQL0401N The data types of the operands for the operation...
T. Blom,
I checked your select, but it didn't seem to work:
db2 => select * from test
ID NAME PARENT
----------- ---------- -----------
1 aaa -
2 bbb 1
3 ccc 1
4 ddd 3
4...
I'd like to represent a hierarchy in a table like
id name parent1 aaa null
2 bbb 1
3 ccc 1
4 ddd 3
is it possible to select reucursivly?
For example for id 4 I would like a result like this:
aaa-ccc-ddd
For id 3 like this:
aaa-ccc
I read in the ansi SQL forum oracle can...
thanks rudy!
I'm using db2 at the moment. I suppose db2 can not do it!?
I will use oracle however in the near future, how would the select command actually look like for the example above?
thorsten
I'd like to represent a hierarchy in a table like
id name parent1 aaa null
2 bbb 1
3 ccc 1
4 ddd 3
is it possible to select reucursivly?
For example for id 4 I would like a result like this:
aaa-ccc-ddd
For id 3 like this:
aaa-ccc
Thanks for your help, unfortunatly DB2 does not allow multiple nulls in a unique columns, I guess I let my application do the job.
db2 =>
create table test (
id integer not null,
name varchar(50),
primary key (id),
unique (name)
)
During SQL processing it returned:
SQL0542N...
Is it possible to create a table with a unique constrain on a column, but allow null values?
I want to make sure that a new value which is inserted into the table is not present already except if it is null.
I would like to insert more rows into the table t_str_dag
using the following select command, but I always get this "specifies multiple columns"- Error
even though the select command alone gives me exactly what I want to insert.???
db2 => select id, id/100 *100 from t_structures...
Does the following help?
select count(*) from t_expression group by clone_id,stage
basically Yes, but like this:
select distinct clone_id, stage from t_expression
...it gives me a list. As I execute it from a java program, I don't want to run through the loops of the result set and count the...
Sorry it was not clear enough.
select count (distinct clone_id) from t_expression
...is not what I'm interested in. I would like to know how many records there are, where the combination of clone_id and stage are distinct. The command above doesn't contain the stage. But if I include the...
This query gives me a list of 1085 records:
select distinct clone_id, stage from t_expression
but I don't need the list, I only need to count them
How can I do this?
This command works, but it is not what I want:
select count (distinct clone_id) from t_expression
These commands do not work...
Thanks, it worked!
describe select * from sysibm.sysindexes
select NAME,CREATOR, TBNAME, COLNAMES from sysibm.sysindexes
sorry I didn't know about the DB2 forum
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.