Home » SQL & PL/SQL » SQL & PL/SQL » Nested Queries
Nested Queries [message #289220] Thu, 20 December 2007 05:29 Go to next message
rnvssudheer
Messages: 2
Registered: December 2007
Junior Member
Hi,

I am new to Oracle, pls help me in this....
I have two tables.
First table name is mobiledetails. It has 3 columns, they are
FULLNAME, DEPARTMENT, MOBILENUMBER
some values are
John   JAVA    990-015-5267
Sudh   J2EE    990-011-5566
SAMS   TEST    999-015-7890

Second Table name is billdetails. It has 3 columns, they are
MOBILENUMBER, SUBSRIBERTOTAL, MINUTESUSED.
some values are
990-015-5267   $131   324   
990-011-5566   $156   264
999-015-7890   $466   089
934-235-7458   $3436  859
949-034-1211   $136   879
934-235-7458   $768   911

My query is to get the number of minutes used for each mobile number, my input is mobilenumber which is coming from first table.

Like output should be
990-015-5267         $131    324

[EDITED by LF: added CODE tags]

[Updated on: Thu, 20 December 2007 06:34] by Moderator

Report message to a moderator

Re: Nested Queries [message #289224 is a reply to message #289220] Thu, 20 December 2007 05:42 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
but , i don't see any difference in your desired output and the data in the second table.look for SUM() ,or are you looking to find the common mobile numbers from the two tables.if that's the case the use JOIN.


regards,

[Updated on: Thu, 20 December 2007 05:45]

Report message to a moderator

Re: Nested Queries [message #289226 is a reply to message #289224] Thu, 20 December 2007 06:11 Go to previous messageGo to next message
rnvssudheer
Messages: 2
Registered: December 2007
Junior Member
my input will come from first table, and a query should be formed, so we have to compare this in the second table and print values of second table..
there i just gave some examples thats all..
Re: Nested Queries [message #289227 is a reply to message #289226] Thu, 20 December 2007 06:21 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
It looks like you are wanting to join the 2 tables:
Pseudo code, you'll have to use your own actual table and column names.
select mobile.name, mobile.dept, mobile.mob, bill.total, bill.used
from mobile
join bill
on mobile.mob=bill.mob
Re: Nested Queries [message #289228 is a reply to message #289226] Thu, 20 December 2007 06:21 Go to previous message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
Quote:

my input will come from first table, and a query should be formed, so we have to compare this in the second table and print values of second table..


can you post what you tried till now.

regards,
Previous Topic: Unable to access Tkprof output...
Next Topic: simple select with ORA-00904
Goto Forum:
  


Current Time: Tue Dec 06 06:28:38 CST 2016

Total time taken to generate the page: 0.05486 seconds