Results 1 to 2 of 2

Thread: Row vs Rows

  1. #1
    Join Date
    Jun 2008
    Location
    India
    Posts
    96

    Unanswered: Row vs Rows

    Hi All,

    I have one senario.

    Create MastBCP
    CREATE TABLE MastBCP (
    code varchar(50),
    newcode varchar(50),
    flatacct varchar(50)
    )

    CREATE INDEX idx ON MASTBCP(FlatAcct)

    INSERT INTO MastBCP VALUES ('MSC','MSC001','4000700DIVD+1|4000710DIVD-1')
    INSERT INTO MastBCP VALUES ('MSC','MSC002','5000700DIVD+1|5000710DIVD-1')
    INSERT INTO MastBCP VALUES ('MSC','MSC003','6000700 -1|6000710DIVD-1|6000720DIVD+1')

    CREATE AcctTrans
    CREATE TABLE AcctTrans
    (ProjectId varchar(50),
    Code varchar(50),
    AcctNbr varchar(50),
    SubAcctNbr varchar(50),
    SubAcctCode varchar(50),
    DrCrInd varchar(50) )

    CREATE INDEX idx2 ON AcctTrans(AcctNbr, SubAcctNbr, SubAcctCode)

    INSERT INTO AcctTrans VALUES ('200100','MSC','4000','700','DIVD','Dr')
    INSERT INTO AcctTrans VALUES ('200100','MSC','4000','710','DIVD','Cr')
    INSERT INTO AcctTrans VALUES ('200200','MSC','4000','700','DIVD','Dr')
    INSERT INTO AcctTrans VALUES ('200200','MSC','4000','710','DIVD','Dr')
    INSERT INTO AcctTrans VALUES ('200200','MSC','4000','720','DIVD','Cr')
    INSERT INTO AcctTrans VALUES ('200300','MSC','5000','700','DIVD','Dr')
    INSERT INTO AcctTrans VALUES ('200300','MSC','5000','710','DIVD','Cr')
    INSERT INTO AcctTrans VALUES ('200400','MSC','6000','700',' ','Cr')
    INSERT INTO AcctTrans VALUES ('200400','MSC','6000','710',' ','Cr')
    INSERT INTO AcctTrans VALUES ('200400','MSC','6000','720','DIVD','Dr')

    Now i want to match the above rows with master table FlatAcct column.If it matches then i have to update NewCode column(I added a new column in AcctTrans table using Alter table statement) of AcctTrans table.

    Say for example, if we take the rows of projectId 200100 it matches against MSC001(MastBCP table).But the format is entirely different in both the table.

    Inputs are higly appreciable!

  2. #2
    Join Date
    Jun 2008
    Location
    India
    Posts
    96
    Any Inputs ?

Posting Permissions

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