Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    29

    Unanswered: Organize data + workflow ? Update column ..

    Hi all,

    Here is the case. I want to create a kind of an view where I present data from a table.

    table1 (Existing) / main columns presented
    seq
    item
    main
    sub
    ...
    ..
    .

    I Want to move main, sub column to a new table or a view. This works fine.
    Code:
    CREATE TABLE custom.table2 (
    	obj_num INT NOT NULL DEFAULT AUTOINCREMENT,
    	main CHAR (50),
    	sub CHAR (50)
        )
    After this I insert the values to table2 from table1
    Code:
    INSERT INTO custom.table2 (main, sub)
    SELECT main, sub
    FROM custom.table1
    The result looks like this now.
    Code:
    1, main1, sub1
    2, main1, sub2
    3, main1, sub3
    4, main2, sub1
    ..and so on
    I Want to reorganize this table by DISTINCT main followed by sub i one row. Little unsecue how to create this, have been thinking about using ALTER TABLE, UNION and GROUP BY. Don´t know if this is the right way to go.

    Wanted result:
    Code:
    1, main1
    2, sub1
    3, sub3
    4, sub3
    5, main2
    6, sub1
    ..and so on
    Next step below:

    If this is possible. Can I reorganize and update obj_num column and sort this by the main and sub. If I want every main to start by the number '1000' and followed by linked sub straight after ?

    The column main and sub could variate a lot in numbers. So I can´t preconfigure the different main and sub to a new specific obj_num.

    Code:
     
    1000, main1
    1001, sub1
    1002, sub2
    1003, sub3
    2000, main2
    2001, sub1
    ..and so on
    Regards

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Since oracle does not use AUTOINCREMENT, you must be in the wrong forum.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Oct 2007
    Posts
    29
    Youré right .. this post is suppose to go into the SYBASE section. Is there any way to move the post?

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •