Need help with a custom table please

  • Hi all,

    Very new to SQL programming so apologies if my terminology is a little off.

    I need some help combining a few tables, however I'm worried that it's not even possible!! (but what do I know)

    So I have 1 table that is just a list of feeds. A, B, C, D etc (15 rows in total) and each feed has other information attached to it such as Full name, location etc etc. I am only interested in the Feed column.

    Each feed then has a corresponding data table which contains a list of records. Eg Feed A data is contained in TableA, Feed B data is contains in TableB and so on.

    Basically what I need is a combined table that shows the list of Feeds in the 1st Column ( So A, B, C, D…..) and then a second column which counts the records from each separate data table corresponding to that feed.

    So the end result would look something like this:

    Feed------No of Records

    A----------4 (from TableA)

    B----------7 (from TableB)

    C----------8 (from TableC)

    D----------1 (from TableD)

    Possible?

    Any help on sql code would be much appreciated.

    Thanks

  • Probably something like this:

    SELECT Feed = 'A', [No of Records] = COUNT(ID)

    FROM TableA

    UNION ALL

    SELECT Feed = 'B', [No of Records] = COUNT(ID)

    FROM TableB

    UNION ALL

    ...

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Perfect. Thanks

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

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