Need Help for a procedure

  • I have a table which represent a Matrix

    like this

    ItemA1

    ItemB1

    ItemA2

    ItemB2

    Where Combination Of ItemA+ItemB represent 1 Axes

    Now user will pass me List of

    ItemA1

    ItemB1

    ItemA2

    ItemB2

    In any combination in a temp table

    proc need to return points with right ItemA1,ItemB1,ItemA2,ItemB2 values

    halp will be appriciated

    Thanks

  • your explanation is too abstract...you did not clearly define the matrix and the possible values(at least for me), nor the actual format of the data that will come from the user.....

    can you post the actual CREATE TABLE statement for your matrix, as well as the INSERT INTO statements for a couple of rows.

    offhand, it sounds like you need to use one of the many split() functions that can be found int he contributions...

    they typically change a delimited string into a table so you can use that for the join.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • CREATE TABLE MATRIX(

    ItemA1 INT,

    ItemB1 INT,

    ItemA2 INT,

    ItemB2 INT,

    Point Int

    )

    INSERT MATRIX

    VALUES(1,1,1,2,1)

    INSERT MATRIX

    VALUES(1,2,2,3,1)

    INSERT MATRIX

    VALUES(1,1,2,2,1)

    ITEMA + ITEMB represent 1 axis in the matrix and combination of all 4 should be unique

    and we cant inter change A1+B2 with A2t+B2

    so in above case we cant insert record in this combination

    INSERT MATRIX

    VALUES(2,3,1,2,1)

    Now user will pass me a tamp table with 4 columns (ItemA1 ,ItemB1 ,ItemA2 ,ItemB2 )

    I have to return all points for this combination

    Thanks

  • jagat.patel (7/1/2009)


    CREATE TABLE MATRIX(

    ItemA1 INT,

    ItemB1 INT,

    ItemA2 INT,

    ItemB2 INT,

    Point Int

    )

    INSERT MATRIX

    VALUES(1,1,1,2,1)

    INSERT MATRIX

    VALUES(1,2,2,3,1)

    INSERT MATRIX

    VALUES(1,1,2,2,1)

    ITEMA + ITEMB represent 1 axis in the matrix and combination of all 4 should be unique

    and we cant inter change A1+B2 with A2t+B2

    so in above case we cant insert record in this combination

    INSERT MATRIX

    VALUES(2,3,1,2,1)

    Now user will pass me a tamp table with 4 columns (ItemA1 ,ItemB1 ,ItemA2 ,ItemB2 )

    I have to return all points for this combination

    Thanks

    Okay, now one more thing and this does not reqire you write any code. Based on the sample data provided, what would be the expected results of the query that needs to be written?

  • user will pass me tmpTable with following valuse

    INSERT MATRIX

    VALUES(2,3,1,2)

    -- this is swith x y cordinate

    -- In table we have inserted record like this (1,2,2,3,1)

    INSERT MATRIX

    VALUES(1,1,2,2)

    -- In table we have inserted record like this (1,1,2,2,1)

    --I want O/P as

    where

    2,3,1,2,1

    1,1,2,2,1

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply