locked
Filter dynamically created data tables using sql query RRS feed

  • Question

  • User1037547548 posted

    Hi friends
    I have little problem here.
    I am creating data tables dynamically.
    I want to filter it using sql query.
    Suppose, I have four data tables with the same structure but records may be different.There are two fields ServiceMethod and Rates.

    Now I want to filter all tables and want to get match records with the ServiceMethod.

    Suppose,four records in First table,three records in other three tables,
    and only two records(Service method) are same in all tables.
    I want to that two records by filtering all tables and sum of rates and want to add matched records in new table and bind dropdownlist.

    Can any guide me how to filter more than one tables using sql query if data tables are created dynamically?

    Thanks in advance. 

    Saturday, May 24, 2008 2:19 AM

Answers

  • User-1167863498 posted

    Thought of moving to Futures / 3.5 extensions thread first thing today as I stayed on this for almost 5 days but it seems I got some affinity to this threadline ;-)

    Few questions:

    Where do you want to run the sql query (from ado.net objects or as temporary sql query in SSMS etc)?

    How do I identify the tables in question (such as name pattern etc) because database can have many other tables, too?

    What is the primary key (service method?) in these tables? If none, then is there a unique key (or column that maintains unique values, even if there is no UK officially)?

    Last but NOT the least, how many records each table holds (ballpark figure, maximum count)?

    Regards, Vasu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 24, 2008 9:13 AM
  • User-1727935884 posted

    I want to filter it using sql query.
    Suppose, I have four data tables with the same structure but records may be different.There are two fields ServiceMethod and Rates.

    Now I want to filter all tables and want to get match records with the ServiceMethod.

    Suppose,four records in First table,three records in other three tables,
    and only two records(Service method) are same in all tables.

    I suppose you have got those 4 table names by the time you perform the filter. And since all the tables have the same structure(schema), I would suggest you perform a Union. i.e. First union all the 4 tables, and then perfrom a sql query by specifying the "ServiceMethod" to the value you want.

    Hope my suggestion helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 29, 2008 11:59 PM

All replies

  • User-1167863498 posted

    Thought of moving to Futures / 3.5 extensions thread first thing today as I stayed on this for almost 5 days but it seems I got some affinity to this threadline ;-)

    Few questions:

    Where do you want to run the sql query (from ado.net objects or as temporary sql query in SSMS etc)?

    How do I identify the tables in question (such as name pattern etc) because database can have many other tables, too?

    What is the primary key (service method?) in these tables? If none, then is there a unique key (or column that maintains unique values, even if there is no UK officially)?

    Last but NOT the least, how many records each table holds (ballpark figure, maximum count)?

    Regards, Vasu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 24, 2008 9:13 AM
  • User-1727935884 posted

    I want to filter it using sql query.
    Suppose, I have four data tables with the same structure but records may be different.There are two fields ServiceMethod and Rates.

    Now I want to filter all tables and want to get match records with the ServiceMethod.

    Suppose,four records in First table,three records in other three tables,
    and only two records(Service method) are same in all tables.

    I suppose you have got those 4 table names by the time you perform the filter. And since all the tables have the same structure(schema), I would suggest you perform a Union. i.e. First union all the 4 tables, and then perfrom a sql query by specifying the "ServiceMethod" to the value you want.

    Hope my suggestion helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 29, 2008 11:59 PM