I want to combine two queries and make it one. Both queries connect from Table1
.
1. Query collect data from table1 for Processor.
2. Query collect data from table1 for Process.
3. Query collect data from table1 as per from date and to date.
I want to create only one new query for above three query.
I am using OLEDB connection to connect MS-Database to Datagridview. Dates format are as "MM-DD-YYYY"
in database and code.
If all queries you intend to run on the same table return the same exact columns as results, you can use the SQL clause UNION
to combine all in one single result table then it is easy to show that query result in a DataGrid on the User Interface.
for example, from here ( but you can search many more examples if this one is too generic )
https://www.techonthenet.com/sql_server/union.php
SELECT expression1, expression2, ... expression_n
FROM tables
[WHERE conditions]
UNION
SELECT expression1, expression2, ... expression_n
FROM tables
[WHERE conditions];