Regd Query

  • so here is the structure of my 4 tables and the datatype of name is varchar(8)

    table 1 Table2 table3 table 4

    type id col1 col2 col1 id col1 id

    new 1

    new 2

    new 3

    opt 4

    new 5

    opt 6

    new 7

    opt 8

    new 9

    so what i really need is now

    i need to get the output as

    desc count ----two columns as my ouput with

    new 6----no of rows with new in table 1

    opt 3----no of rows with new in table 1

    total 9---total number of rows in table 1

    row4 5----total number of rows in table 2

    row5 4----(row3-row4)---(9-5)

    row6 10----total number of rows in table3 where t1.id=t3.id

    row7 12 ---total no of rows in table 4 where t1.id=t4.id

    all should be in the same query how can i do that please let me know....

    any suggestoin would be helpful...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • I think you're missing some data in the other tables. Also, you'll get a much quicker answer if you format the data as outlined in the Link located in my signature line below.

    Last, but not least, this looks like a test or maybe homework... I don't have a problem with that if you try... please show the code that you've tried.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 2 (of 2 total)

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