Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Thorsten3

    select reucursivly

    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...
  2. Thorsten3

    select reucursivly

    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...
  3. Thorsten3

    select reucursivly

    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...
  4. Thorsten3

    recursive select

    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
  5. Thorsten3

    recursive select

    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
  6. Thorsten3

    unique or null

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

    unique or null

    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.
  8. Thorsten3

    multiple insert

    T. Blom: Thank you, this works. Thorsten
  9. Thorsten3

    multiple insert

    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...
  10. Thorsten3

    count distinct

    Thanks crufty and bperry this worked SELECT count(*) FROM ( select distinct clone_id, stage from t_expression) as q
  11. Thorsten3

    count distinct

    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...
  12. Thorsten3

    count distinct

    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...
  13. Thorsten3

    count distinct

    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...
  14. Thorsten3

    list indexes

    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
  15. Thorsten3

    list indexes

    Thanks a lot! Unfortunatly I use DB2 and both comands didn't work. :(
  16. Thorsten3

    list indexes

    I just learned how to create an index and how to drop an index. Is there a way to list or view indexes?
  17. Thorsten3

    hierarchical tree

    I wanted to represent a hierarchical tree in a table. Unfortunately I chose a not very elegant way, by creating a table with as many columns as levels in the tree (see table t_old below). Now I want to change this. I created a new tables (t_new) which contains only three columns (id, structure...
  18. Thorsten3

    select distinct ... order by ...

    I only want the distinct values of the column named structure. These should be ordered depending on the value of another column named str_order. I'm using db2 by the way. My two commands mentioned above result in errormessages.
  19. Thorsten3

    select distinct ... order by ...

    I need to select all distinct "structures" of a table and order them depending on the value of column "str_order". The following two commands don't work. select distinct structure from T_STRUCT_FEAT_M where stage='m' order by str_order select distinct structure from (select...
  20. Thorsten3

    alter column of table containing data

    I need to alter a column of a table, containing data allready, from varchar(4) to varchar(6), because I need to store longer strings than I expected. The new table should contain all the data as the old one and should have the same name as the old one. How can I copy the structure and the data...

Part and Inventory Search

Back
Top