I am using SQL Server I have 2 tables :
table1 : for buying data data {item_id,price ,...} table2 for shopingcart data (item_id,datetime,...)
How can I find the probability of buying which is equal to = number_of_item_in table2 / number_of_item_in table 1;
which is better :
use :
set count1=(select count(*) from table1)
set count2=(select count(*) from table2)
and print count2/count1;
or by something like :
select c2/c1 as probability from
(
select count(*) as c1 from Table1 , select count(*) as c2 from table2)
)
please which of them is more effective .