Click here to Skip to main content
15,918,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For acquire a subtraction which is faster ?
1.Send two queries to SQL database and get two integer data,then : subtraction = (result of query 1 - result of query 2 )
2- Write a subtractions query like :
SQL
select (A)-(B) from Database_name1 inner join Database_name2 on key1=key2 where conditions 
Send to Database and get a Direct result

Is there a difference between a simple query and a join query ?
----------------------
Additional Info :

SQL Server 2012
Visual Studio 2012 (.Net 4 and higher)
C# environment
Posted

1 solution

Single query should be quicker: SQL is pretty efficient and it saves the network communications which are likely to be the bottleneck here.

But instead of asking questions like this, why not try it and see? Use the Stopwatch class and time 10,000 repeats of each operation. the quickest one is the winner...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900