0

Good noon to every one my query is that i have one table name Purchase&Sales and two different field Purchase Sales the data which will be in Purchase text box will be fetch from Total purchase table and the data will be in sales table will be fetch from Total Sales Table means the both Value will come from different table to one table So please Give me a syntax or some idea Hoping for your Great and positive response

2
  • Did you try anything? Commented Oct 3, 2013 at 10:56
  • You can use join in query. Commented Oct 3, 2013 at 10:58

3 Answers 3

1
select sum(Purchase) Result from PurchaseTable
union all
select sum(Sales) Result from SalesTable
Sign up to request clarification or add additional context in comments.

Comments

0

Using JOIN or try with ForeignKey concept if any.

Comments

0
SELECT 
     S.Total, -- selecting from one table
    P.Total -- selecting from another table
FROM
    Sales S
INNER JOIN -- inner join if you can or similar
    Purchase P
ON
   S.PurchaseId = P.ID

see here for more info http://www.techrepublic.com/article/sql-basics-query-multiple-tables/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.