471,873 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Need Help for query



I have two tables Income(Date, IncomeType, Amount) and Expense(Date,
ExpenseType, Amount). I want to create a balance sheet report for which
need a query or view which creates a virtual table of form
BalanceSheet(IncomeType, IncomeAmount, ExpenseType, ExpenseAmount). The
table should look like:

Salary 100000 Rent a Car 5000
(null) (null) Tution 1000
.................................................. ....
.................................................. ....
How can it be done?

Appreciate for the help.

Raju

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
4 1861
Raju Shrestha wrote:

I have two tables Income(Date, IncomeType, Amount) and Expense(Date,
ExpenseType, Amount). I want to create a balance sheet report for which
need a query or view which creates a virtual table of form
BalanceSheet(IncomeType, IncomeAmount, ExpenseType, ExpenseAmount). The
table should look like:

Salary 100000 Rent a Car 5000
(null) (null) Tution 1000
.................................................. ...
.................................................. ...
How can it be done?

Appreciate for the help.

Raju

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Seems like you are asking someone to do your homework for you.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
http://www.outreach.washington.edu/e...oa/aoa_crs.asp
da******@x.washington.edu
(replace 'x' with a 'u' to reply)

Jul 20 '05 #2
Raju Shrestha (ra**********@yahoo.com) writes:
I have two tables Income(Date, IncomeType, Amount) and Expense(Date,
ExpenseType, Amount). I want to create a balance sheet report for which
need a query or view which creates a virtual table of form
BalanceSheet(IncomeType, IncomeAmount, ExpenseType, ExpenseAmount). The
table should look like:

Salary 100000 Rent a Car 5000
(null) (null) Tution 1000
.................................................. ...
.................................................. ...
How can it be done?


For this of question, please always include:

o CREATE TABLE statements for the involved tables.'
o INSERT statements with sample data.
o The expected output from the sample data.

The reason for this is that it reduces the amount of guessing for anyone
who is trying to help you. It also makes it possible to post a tested
solution.

Of course, if Daniel Morgan's assumption is right that this is a class
assignment, you should solve the problem on your own.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

If everybody thinks (like Mr. Daniel Morgan) the questions in forum as
someones homework, the question raises for such forums and/or for the
need of that kind of people to participate in forums. Of course
sometimes the question might not be so clear to the others, in such case
better suggest for more details/specific like Erland did for which I am
thankful to him.

Regarding my question its not any homework. I gave those table examples
to make the question clear.I just wanted to know (if any) how two tables
(unrelated) can be joined by column without any duplication of records.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
Raju Shrestha (ra**********@yahoo.com) writes:
Regarding my question its not any homework. I gave those table examples
to make the question clear.I just wanted to know (if any) how two tables
(unrelated) can be joined by column without any duplication of records.


Again, I repeat from my previous posting:

For this of question, please always include:

o CREATE TABLE statements for the involved tables.'
o INSERT statements with sample data.
o The expected output from the sample data.

Else I would have to guess what you're aiming at.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by lawrence | last post: by
9 posts views Thread by netpurpose | last post: by
10 posts views Thread by L. R. Du Broff | last post: by
3 posts views Thread by pbd22 | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.