How to get multiple records in a line and a different column
Hi allI am using oracle database 11g
and I have a two table table_1, table_2
table_1 has columns
emp_no
first name
middle_name
last_name
and table_2 have columns
emp_no
phone_type
Phone_Number
and having entires
emp_no phone_type phone_number
1001 MOB 9451421452
1001 WEMG 235153654
1001 652341536 EMG
1002 MOB 9987526312
1003 WEMG 5332621456
1004 59612356 EMG
Now I want the output of values with the MOB or WEMG phone type in a single line with different columns
emp_no first_name last_name middle_name officeno mobile e-mail
1001 score null k 9451421452 235153654 [email protected]
1002 chagneau gary [email protected] 9987526312 null
1003 dany craig [email protected] 5332621456 null null
1004 donald finn sian [email protected] null null
Can I have any input to achieve this?
Concerning
$sid
Hi Sid,
Under query will be help for you...
SELECT tab1.emp_no
*, first name *.
*, middle_name *.
*, last_name *.
*, email *.
*, mobile t2.phone_number *.
*, t3.phone_number officeno *.
OF tab1
*, (SELECT Emp_no *)
*, phone_number *.
Of THE tab2
WHERE phone_type = "MOB") t2
*, (SELECT Emp_no *)
*, phone_number *.
Of THE tab2
WHERE phone_type = "WEMG") t3
WHERE tab1.emp_no = t3.emp_no
AND tab1.emp_no = t2.emp_no;
Thnks,
cveluri
Tags: Database
Similar Questions
-
Data merge: how to get multiple records in a single text?
Hello
I'm experimenting with data merging in InDesign CS3. The biggest obstacle I've met tries to get my record flowing continuous text in a single text frame (which would, ideally, "automatic formatting" on the new pages in the document). Records vary considerably in length, and so I can't just create a standard repeat on the page text frame.
Perhaps, data fusion is not the best way to achieve this and I should be learning to script in place. I feel like I'm just one step, however.
Any suggestion would be appreciated.
Data fusion is not thread. There is a nifty script to Rorohiko who will do it for you after the merger, however. Best strategy is to merge, run the script, delete everything except the first image on the first page, then pick up the excess and auto-flux in the document.
-
How to get the record for the top 3 of aggregate column
Hello
I have a simple query that returns all students in class with the total points. now, I want to choose the best 3 interns that maximum score. simple top three position. How can I use function rank here? or any other way to doselect st.sti_roll_no ,st.sti_name , sum(rd.rd_obt_marks) as mycol from rd_result_detail rd , rm_result_master rm, sti_student_info st where rm.rm_result_id = rd.rd_result_id and st.sti_roll_no= rd.rd_student_id --and rd.rd_student_id = 'MBP10293' and rm.rm_semester = 3 and rm_session = 2009 and rm_batch= 3 and rm.rm_exam_type ='FINAL TERM' and rm.rm_class_id = 'MBA' group by st.sti_name, st.sti_roll_no order by st.sti_roll_no;
not sure try now
with t as (select st.sti_roll_no ,st.sti_name , sum(rd.rd_obt_marks) as mycol from rd_result_detail rd , rm_result_master rm, sti_student_info st where rm.rm_result_id = rd.rd_result_id and st.sti_roll_no= rd.rd_student_id --and rd.rd_student_id = 'MBP10293' and rm.rm_semester = 3 and rm_session = 2009 and rm_batch= 3 and rm.rm_exam_type ='FINAL TERM' and rm.rm_class_id = 'MBA' group by st.sti_name, st.sti_roll_no order by st.sti_roll_no) select e.* from (select sti_roll_no ,sti_name,mycol,dense_rank()over(order by mycol desc) rnk from t) e where rnk<=3
-
How to view multiple records to a report form - as the model?
Hi all
I developed a form - like model report
I want to show him several records at once (on the same page)
I tried assigning a value of "Maximum records per page" property for the extensible framework 10
but when I close the range property and open it again the value returns to 1!
How to display multiple records on the same page?
Thank youHello
check around your formatting images if all have the "vertical stretch" value to the variable or develop.
-
How to get the string (specified by row and column) of txt file with labview
Hello world
How to get the string (specified by row and column) of txt file with labview
THX
As far as I know, a text file has no column. Be more specific. Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character? You can read from the spreadsheet String function and set the delimiter to a space. This will produce a 2D channels table. Then use the table to index and give the line number and column number.
-
How to get the angles of view (horizontal and vertical) camera?
How to get the angles of view (horizontal and vertical) camera?
The horizontal and vertical field of VIEW properties are available with the camera_get_physical_property() function.
Who is using the C API of the photo. I don't think that you can access by using the control of the camera of Cascades.
-
How to get my key of windows 8 and reinstalled it on my computer?
I bought a laptop with a windows pre-installed 8 and had it upgraded to 8.1. Unfortunately my bios and the hard drive crashed. I got the bios re-installed and replaced hard drive but I don't have my windows key 8 that my laptop did not come with a sticker. How to get my key of windows 8 and reinstalled it on my computer?
OT: recovery of windows 8
Hey fatty,.
What is the brand and model of the computer?
Windows 8 is a preinstalled version, you must contact the manufacturer of your laptop to get the product key. As OEM (original equipment manufacturer) product keys be provided by the manufacturer of the computer.
I hope this helps. Let us know if you have other problems with Windows in the future.
-
How to get the specific information of hardware and software data center
How to get the specific information of hardware and software data center with powercli...
What kind of information you need?
No matter what Esxi host hardware info., if so could below thread is useful.
Information about the host material with information on the nic and HBA drivers
-
@
How to get everyone how to get all the style of paragraphs and their policies of an indesign file and write all the info with info para in a txt file with scriptingstyle and their policies of an indesign file and write all the info with info para in a txt file with scripts
Hello
Try this,
var doc = app.activeDocument, pstyles = doc.allParagraphStyles, report = ""; for(var i =0;i
Kind regards
Cognet
-
How to get data from a database table and insert into a file
Hello
I'm new to soa, I want to create an xml with the data from database tables, I'll have the xsd please suggest me how to get the data in the tables and insert in a file
concerningin your bpel process, you can use the db adapter to communicate with the database.
with this type of adapter, you can use stored procedures, selects, etc to get the data from your database into your bpel workflow.When did it call in your bpel to the db adapter process it will return an output_variable with the contents of your table data, represented in a style of xml form.
After that, you can use the second card (a file synchronization adapter) to write to the content of this variable in output to the file system
-
How to get the value of a particular tag to a column (clob)
Hi friends,
How to get the value of a particular tag to a column (clob), which has an XML value?
Thanks in advance.
Kind regards
Sirot ChauvetYou are welcome, if you got your answer to the question as such brand
-
Create model XMLP for lines in 2 different columns?
Hi all, is it possible to create a model of XMLP which shows the same group of data, but in 2 different columns, i.e. the left column display (say) first 10 lines and the right column display lines of the 11th-20th?
The XML source contains only the total number but no individual line number.
Thank you very much!I have 2 columns of the table.
And in each column of a table. Round table can have at a time for each -
How to get rid of the reference lines on the front panel
I forgot how I created a couple of horizontal and vertical lines on the front panel. It seems that the original on the front lines. When I move my program to another monitor with a different resolution, the layout is messed up because of the reference lines cannot change the resolution. Everybody respected this before? How to get rid of them?
Attached are the 2 creen shot of facades.
Thanks in advance.
Ah, I figured out. I accidentally selected the "scale with objects pane" from the context menu of a button in the tab. This is whence the reference lines.
Thanks for all your guys help and advice.
-
How to get multiple rows in the table is displayed on the form
I am looking for a way to get more table rows that appear on the form. I created a table with a header and a line with the add-in and remove button option. I like how the sample purchase order form has it setup in the designer it shows one line and it appears on the form so the table has three rows to start with. How do I do that? I looked at the code on the sample and I couldn't find it anywhere. Please help, thanks.
Hello
I have an example here in the construction of a dynamic array markets.
http://www.assuredynamics.com/index.php/category/portfolio/building-dynamic-tables/
You must select the line and then go to object > Binding palette and set it to repeat. You can set the minimum and initial number to what you want.
The form should be saved in a dynamic form of XML in the Save as dialog box.
Also the page must be set to Flowed, so that as the table grows, push another object down. In addition, you need to configure the paging settings so that the flow of the page as the number of lines is superior to a single page.
Give a start and if you need more help,
Niall
-
How to concatenate multiple records in a single
Hello world:
I want to know if is a way to concat multiple records into one without the help of the sliders. For example, I have a table named "Authors" like this:
LAN | Author
-----------------
English | Ernest Hemingway
Spanish | Octavio Paz
Spanish | Mario Vargas Llosa
English | Sinclair Lewis
Spanish | Gabriel García Márquez
And I want to get this:
Author
-----------------
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo. MyConcat (@lan varchar (10))
RETURNS varchar (5000) AS
BEGIN
declare @retvalue varchar (5000)
Set @retvalue = "
Select @retvalue = @retvalue + author + ',' authors where lan = @lan
return substring (@retvalue, 1, len (@retvalue)-1)
END
That is to say, do not use cursors to concatenate records. However, with ORACLE, I do something like that.
FUNCTION MyConcat(P_Lan IN VARCHAR2) VARCHAR2 IS BACK
v_ret VARCHAR2 (4000);
v_element VARCHAR2 (4000);
v_cursor sys_refcursor;
BEGIN
OPEN to SELECT V_cursor author of authors where Lan = P_Lan
LOOP
SEEK v_cursor INTO v_elemento;
OUTPUT WHEN v_cursor % NOTFOUND;
IF v_ret IS NULL THEN
v_ret: = v_element;
ON THE OTHER
v_ret: = v_ret | ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
There is another way to to do?
Best regards
JackYou can find plenty of examples here:
http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php
and also here:
http://www.sqlsnippets.com/en/topic-11787.html
Published by: hoek on October 21, 2010 17:50
Maybe you are looking for
-
I'm trying to use on a dynamic called vi control value. Control is an object. Everything works except if I dynamically load the vi project packed library. When I do that and then set the value of control returns error 91 "the variant data type is not
-
TI 1520 card reader works fine with 256 MB PCMCIA cards. I can start with the card in the drive and the drive appears in my computer properly as a removable disk. XP Pro with Service Pack 3. Device Manager shows two entries 'Texas Instruments PCI-152
-
I have my Vista connected to the network and the "network and sharing Center" shows that it is connected and network is accessible, but the network in the status bar icon displays an icon showing disconnected state. How to solve this problem? Restart
-
6600 fine prints for a while, then closes and it says unable to print printer
I have the HP OfficeJet6600, I can print for a while, and then, I get the message unable to print, I can set up my network again and it works, the calendar on / stop are disabled. I must put in place every time I want to print, I have reinstalled se
-
All the keywords entered in Lightroom CC no appear in the Photoshop Info file
HI: The solution to this problem seems like it's pretty easy, but I have not found an answer after a little research. So I apologize in advance if it is dealt with elsewhere.Here's the situation. In Lightroom CC, I type in the Keywords field all the