• mrivero1961 (3/28/2013)


    mrivero1961 (3/28/2013)


    Sean Lange (3/28/2013)


    This is MySql. If you want to join multiple queries together you probably need to use UNION.

    I really can't tell from what you have posted what the actual issue is here. I can try to help but without ddl (create table statements) and sample data (insert statements) it is pretty hard to figure out what is going on.

    🙁

    I need join the TABLE_LONG and TABLE_SHORT for in output the sum of number of events.

    TABLE_SHORT

    +--------+-----------+

    | sGIG | NUMBER |

    +--------+-----------+

    | QI | 2 |

    | QM | 2 |

    | QO | 16 |

    | QS | 6 |

    | Tot | 26 |

    +--------+-----------+

    TABLE_LONG

    +--------+--------+

    | sGIG | NUMBER |

    +--------+--------+

    | QI | 9 |

    | QM | 2 |

    | QO | 6 |

    | QS | 5 |

    | Tot | 22 |

    +--------+--------+

    output:

    +--------+--------+

    | sGIG | NUMBER |

    +--------+--------+

    | QI | 11 |

    | QM | 4 |

    | QO | 22 |

    | QS | 11 |

    | Tot | 48 |

    +--------+--------+

    We keep going round'n'round because we don't actually know what your data looks like. Please see the article at the first link in my signature below for how to help us help you get the best answer. Thanks.

    --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)