Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
6 different type of tables in database .

Table Is :

Column Name is Same ('Price') Common In All Tables
Table 1: Price 1$,
Table 2: Price 1$,
Table 3: Price 1$,
Table 4: Price 1$,
Table 5: Price 1$,
Table 6: Price 1$,  


I need Total Count IS + 6$,

How to Write Stored procedure ?
Posted
Updated 1-Mar-14 1:46am
v4
Comments
NeverJustHere 1-Mar-14 7:24am    
Your question doesn't make any sense. Please edit and state more clearly what you are having trouble with.
Sai Prasad anumolu 1-Mar-14 7:33am    
kk Sir ,... I Modify question
OriginalGriff 1-Mar-14 7:25am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Sai Prasad anumolu 1-Mar-14 7:34am    
I modify the Question Check It Sir

1 solution

If you want a SP you should do soemthing like the next code:
SQL
CREATE PROCEDURE [dbo].[GetTotalCount]
AS
BEGIN
    Select Table1.Price + Table2.Price + Table3.Price + Table3.Price+Table4.Price+Table5.Price+Table6.Price as TotalCount FROM Table1,Table2, Table3, Table4,Table5,Table6
END
 
Share this answer
 
Comments
Sai Prasad anumolu 1-Mar-14 8:33am    
hi sir , Its working But , I have one problem is coming ,
For Example : Table 1 - Price 1$, Table 2 - Price No Price, Table 3 - Price 1$, Table 4 - Price 1$, Table 5 - Price No Price, Table 6 - Price ,No Price

I need to display total count is : 3$ .. It is not comming Sir , Final output is not diplay ,
Price is their value counting , But i need price is there or not their , Available price is counting Sir
Siva Hyderabad 3-Mar-14 5:05am    
In this case you have to use ISNULL() function, so in place of SELECT Table1.Price + Table2.Price + ...
you should use: SELECT ISNULL(Table1.Price, 0)+ ISNULL(Table2.Price,0) + ...
Sai Prasad anumolu 3-Mar-14 6:33am    
I got Solution Brother ....

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