How to match set of sql queries in the t1 with data in t2
Posted: Sun May 17, 2009 12:25 am
How to match set of sql queries in the table1 with data in the table2?
Table1:
Serial no. Column1
1
2
3
4
5
* Column1 –Varchar
Table2:
Dept. No Name Age Marks
100 A 20 75
Requirement:
Table1 with column of varchar contains set of SQL queries. Table2 contains data. Need to get all the SQL queries from the table1 which are matching to a particular data in the table2.
Result Expected:
Need a sql query which returns the following result.
Question:
Table1 with column of varchar contains set of SQL queries. Table2 contains a record data. Need to get all the SQL queries from the table1 which are matching to a particular record data in the table2.
I know, I can get all the SQL queries in the table1 by executing each SQL query string one by one against the table2 record data by using database procedures.
I am afraid, if I have thousands of SQL queries in the Table1 and fire each query one by one with the table2 record data, may cause latency and performance bottleneck.
Please refer the attached document.
How do we do this efficient way?
Any suggestion, experts help us.
Table1:
Serial no. Column1
1
Code: Select all
SELECT * FROM Table2 WHERE Name=’A’ AND Age=20Code: Select all
SELECT * FROM Table2 WHERE Name=’A’ AND Marks=100Code: Select all
SELECT * FROM Table2 WHERE Name=’B’ AND Age=21Code: Select all
SELECT * FROM Table2 WHERE Age=20 AND Marks=75Code: Select all
SELECT * FROM Table2 WHERE Name=’A’ AND Age=21Table2:
Dept. No Name Age Marks
100 A 20 75
Requirement:
Table1 with column of varchar contains set of SQL queries. Table2 contains data. Need to get all the SQL queries from the table1 which are matching to a particular data in the table2.
Result Expected:
Need a sql query which returns the following result.
Code: Select all
SELECT * FROM Table2 WHERE Name=’A’ AND Age=20Code: Select all
SELECT * FROM Table2 WHERE Age=20 AND Marks=75Question:
Table1 with column of varchar contains set of SQL queries. Table2 contains a record data. Need to get all the SQL queries from the table1 which are matching to a particular record data in the table2.
I know, I can get all the SQL queries in the table1 by executing each SQL query string one by one against the table2 record data by using database procedures.
I am afraid, if I have thousands of SQL queries in the Table1 and fire each query one by one with the table2 record data, may cause latency and performance bottleneck.
Please refer the attached document.
How do we do this efficient way?
Any suggestion, experts help us.