473,372 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 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 1893
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
3
by: pw | last post by:
Hi, I am having a mental block trying to figure out how to code this. Two tables: "tblQuestions" (fields = quesnum, questype, question) "tblAnswers" (fields = clientnum, quesnum, questype,...
7
by: K. Crothers | last post by:
I administer a mechanical engineering database. I need to build a query which uses the results from a subquery as its input or criterion. I am attempting to find all of the component parts of...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.