Splitting of multiple lines on a single line with different fields
Hi allI have a table. A Course_Code have section_codes several other words ('NUM' column is not sectype is just an order!)
Code---num---Sec_code---Sectype---DESC---WEIGHT
1603 1 - C 7427 - Coursework - 50
1603--------2-------7428-----------E------------ Exam---------------- 50
I query this table I want to be able to see the course work, review divided on the same line. i.e.
Code - Coursework - review
1603 C = 50 - E = 50
any help would be great
Hello
'Splitting' means take an element (such s as a string 'C = 50') and diviiding in smal; LER objects (such as the chains under "C" and "50"). Are you really trying to divide something, or are you trying to do exactly the opposite (for example, combine smaller chains in a larger string)?
I think that what you are looking for is a Pivot . Like so many other things, exactly how do depends on your version of Oracle and your needs.
Here's one way:
SELECT code
, MIN (CASE WHEN descr = 'Coursework' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Coursework' THEN weight END) AS coursework
, MIN (CASE WHEN descr = 'Exam' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Exam' THEN weight END) AS exam
FROM table_x
GROUP BY code
;
It will work in Oracle 8.1 and higher. From Oracle 11.1, you can also use the SELECT... Function PIVOT.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.
Tags: Database
Similar Questions
-
Updated several lines with different values
Hello!
I have a problem. I need to update more than 1000 lines with different values. How can I do?
For exsample I have table:
ID; color, date,
1 red
2 green
3 white
I need to update the date field.
Update table
Set date = '01.02.03'
where id = 1
Update table
Set date = '01.03.03'
where id = 2
Maybe it's how to update multiple rows in a single request?
Sorry for my bad English.
Thank you!Hello
You can try this
UPDATE TABLE SET DATE = CASE WHEN ID = 1 THEN TO_DATE('01-02-03','DD-MM-RR') WHEN ID = 2 THEN TO_DATE('01-03-03','DD-MM-RR') END
see you soon
VT
-
Can't understand why this query returns multiple lines with the same data
Hi all
I am a relative novice and self-taught when it comes to SQL. I wrote a query to our reporting tool that returns multiple rows, and I can't understand why. I know that I can use the SELECT DISTINCT option, but it really slows the execution when I do. I'd really rather understand if I can change the code to avoid the multiples. This is the query. I've included a few statements in italics to help explain the break. Any ideas?
SELECT MATSITE, MATPONUM, FIRSTRECPTDATE
Of
Subquery that concludes the first date on which purchase orders have been implemented with ACK State
(SELECT ACKSTAT. PONUM AS 'ACKPONUM', (MIN (ACKSTAT. CHANGEDATE)) AS 'FIRSTACKDATE '.
OF PZMAX. POSTATUS ACKSTAT
WHERE (ACKSTAT. STATE = 'ACK') AND (ACKSTAT.ORGID ='CGSALTUS)
GROUP OF ACKSTAT. PONUM),
Subquery that concludes the first reception against a purchase order transaction for purposes of comparison
(SELECT TRANS. PONUM AS "MATPONUM", TRANS. SITEID AS 'MATSITE', (MIN (TRANS. TRANSDATE)) AS 'FIRSTRECPTDATE '.
OF PZMAX. MATRECTRANS TRANS
WHERE (TRANS.ORGID ='CGSALTUS) AND (TRANS. HOUR > =: startDate and TRANS. TRANSDATE < =: endDate)
TRANS GROUP. SITEID, TRANS. PONUM)
WHERE
(ACKPONUM = MATPONUM AND FIRSTRECPTDATE < FIRSTACKDATE) OR (NOT EXISTS (SELECT 1 FROM PZMAX. POSTATUS ACKSTAT2 WHERE (ACKSTAT2. PONUM = MATPONUM) AND (ACKSTAT2. STATE = 'ACK') AND (ACKSTAT2.ORGID ='CGSALTUS)))
The where the instruction is intended to find when one of two conditions exists. ((1) received happened before the command either in ACK or 2) a reception that's happened, but the purchase order is never in ACK State. It seems that this second condition that creates multiple lines.
Any thoughts will be appreciated geratly.
Dave Teece
-
SQL - Multiple Fetch in a single column with a comma separator
Hello Experts,
Good day to all...
I need your help on the following scenarios. The following query returns all channels titleID. Rather than print them one under the other as a result of the query, I want the output to be in the batch of 25 values.i.e than each line must have 25 values separated by commas. IE if there are 100 titles satisfying the output, then there should be only four lines with and each line with 25 titles in comma separated way.
I tried with the PL/SQL block; Whereas it is printing all the values permanently :(SELECT DISTINCT title_id FROM pack_relation WHERE package_id IN ( SELECT DISTINCT fa.package_id FROM annotation fa GROUP BY fa.package_id HAVING COUNT (fa.package_id) <100);
I have to stop with 25 values and display.
If its possible with SQL block alone. then it would be a great help
Thank you...DECLARE v_str VARCHAR2 (32767) := NULL; CURSOR c1 IS SELECT DISTINCT title_id FROM pack_relation WHERE package_id IN ( SELECT DISTINCT fa.package_id FROM annotation fa GROUP BY fa.package_id HAVING COUNT (fa.package_id) <100); BEGIN FOR i IN c1 LOOP v_str := v_str || ',' || i.title_id; END LOOP; v_str := SUBSTR (v_str, 2); DBMS_OUTPUT.put_line (v_str); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line ('Error-->' || SQLERRM); END;
You can use CEIL
Code example
SELECT nt, LTRIM(MAX(SYS_CONNECT_BY_PATH(val,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val FROM ( SELECT val, nt, ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val) AS curr, ROW_NUMBER() OVER (PARTITION BY nt ORDER BY val) -1 AS prev FROM ( SELECT level AS val, ceil(rownum/3) as nt /* Grouped in batches of 3 */ FROM dual CONNECT BY level <= 10 ) ) GROUP BY nt CONNECT BY prev = PRIOR curr AND nt = PRIOR nt START WITH curr = 1; NT CONCAT_VAL ---------- -------------------------------------------------------------------------------- 1 1,2,3 2 4,5,6 3 7,8,9 4 10
Your code
SELECT nt, LTRIM(MAX(SYS_CONNECT_BY_PATH(title_id,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concat_val FROM ( SELECT title_id, nt, ROW_NUMBER () OVER (PARTITion BY nt ORDER BY title_id) AS curr, ROW_NUMBER() OVER (PARTITION BY nt ORDER BY title_id) -1 AS prev FROM ( SELECT title_id, ceil(rownum/25) AS nt /* Grouped in batches of 25 */ FROM pack_relation tdpr JOIN annotation fa ON tdpr.package_id = fa.package_id GROUP BY title_id, fa.package_id HAVING COUNT (fa.package_id) < 500 ) ) GROUP BY nt CONNECT BY prev = PRIOR curr AND nt = PRIOR nt START WITH curr = 1;
-
Question-DAQmx: using multiple channels on a single device with a relaxation
The purpose of the attached VI (Switching_Controller.vi) is to wait for a triggering of the input signal and an output pulse whenever it occurs. However, at the same time I want to output and read a sample of another entry and exit of the pair of channels (Main_Controller.vi behavior). I was counting on this operation in two parallel Subvi but I am running in the commune-50103 error 'the specified resource is reserved. I understand that in order to solve this problem, I need to compress all output channels and all channels of entry into just two tasks. However, I cannot address the issue of the trigger, because I want the second set of inputs and outputs to occur continuously and relaxation force the task to a certain repetition rate. Is it possible to run a multichannel task in two parallel Subvi?
Thank you for the insight.
Hello!
Please post on the Forums OR! 'Reserved resources' are a common mistake and it seems that you are aware of its source. With the help of two tasks of the same type at the same time without having anything between the two that uncommits resources will not work. Your best option here would be to combine all your HAVE AO in another task in a task and every one of you.
What you could do is to use an analog line available that you can analyze and implement a logic with something as a structure case to insert a value in a table, display it, open a session, or all you want to do with it, when this analog channel crosses a value you're looking for.
You can include your other I / AO in the tasks and have just their acquisition / output as usual.
Hope that this gets you going in the right direction. Have a great day!
-
I have a strong desire to help my father who is a sailor searching for an answer regarding his problem with his laptop. His laptop is very important to him, because he uses this fact to his work, particularly in the preparation of reports and other kinds of things. They do not have Internet connection that's why I'm the one who send right now for this message.
The problem is that the laptop has no display after having turned it on, it just show a few colored lines, and then after a while, the monitor is totally blackout curtains. My father tried to use his laptop, even if it does not display, he provided his password and had pressed enter and heard the sound of the operating system. The sound he heard was similar to the sound at the start of the BONE. He even tried to close the session blindly and he could again hear the sound you hear when you connect on a Vista operating system.
I would like to ask if the problem is on the LCD screen, video card or even with the software? If it's a hardware problem, could you tell if my father could buy the piece of hardware he'd be able to fix his laptop?
If you have ideas to share, I'd be very happy. Thank you in advance.
OK, I'll post my message here. Thanks for the tips! Have a great day!
-
Good corners of lines with different angles
Hi, I am a beginner with Illustrator. I would like to smooth the corners of the strings attached to each other. In this screenshot, you'll see 3 changes of direction. I would like these changes of angles be rounder. How can I join these lines to be able to change their 'corners' to be smooth? Thank you.
I'm embarrassed to ask you once again, but I chose all the lines (direct), but I don't see the choice of angle in the control bar. I also tried the effects > round corner... and it does not work. I use the 19.1.0 version. This must be the problem... I'll get the script of all round corner by Hiroyuki Sato. I guess I can find it by searching for the name of the author. Thank you.
-
Adding lines with different Types of dashboard
Hi all
I am trying to add lines to a file in Adobe Acrobat X Pro, but I need them to have cirlces, triangles, x, etc. I see that Adobe already has different types of line under the Properties tab for a line, but I was wondering if it was possible to add/import of new line styles.
Thank you
Allie
Hi allieeuropa,
According to my understanding, there are no other ways to add new lines of style to the PDF document.
Acrobat includes a markup various options by which you can draw lines as well as to take other forms on line (as illustrated below):
Please specify what you want exactly for.
Hoping to hear from you.
Kind regards
Ana Maria
-
Newbe - straight line with different curves at each end
I am usually not using Illustrator I'm sure you can tell. I need several accolades, but none will really because they cover different lengths and must be the same size. It seems that the best way is simply to create an assemble two straights, but I can't yet determine how a curved at one end of the line - end yet only a second curve different at the other end. Thank you. Rick
shiesl,
For the form of the brace, you consider quarter circles at the ends and a pair in the Middle, all with the same RADIUS.
You can:
(1) create a circle with the Ellipse tool and cut it into quarters to anchor Points; You can then use all the bits or just one or two of them copies,
(2) place in the first quarter with the inner end where you want only the first part of right to start (on one side of the planned right part),
(3) place the second quarter (corresponding to a rotation of 180 degrees) opposed (on the other side of the planned right part) where you want the right part of the firrst at the end,
(4) with the direct Selection tool, select the two ends and the object > path > join now, you have half brace,.
(5) object > transform > reflect, align the two halves and join them to the midlle.
For different lengths, you can select directly the two anchor either end away from the middle (you can use arrow, object > transform > Move or other means).
(If you want to just rounded at the ends, you can simplify the suggestion here, just have the other on the same side at 3) and finish by 4).
-
Adding new line with image field
Hi all!
I have trouble getting my image fields to work the way I need them for. (Example attached). What I need is for the user (who intends to use Reader) to enter text information, then enter a room, or a diagram and then, if necessary add another set of texts and the room. I need each row to add and remove as well independently (similar to my line of text is already configured). I tried to have a table set in place and repeat as the table, but the field of the Image will not work properly and shrinks to a small size. I really want the user to be able to determine the size.
Is it possible that I can do this?
With the change of structure of the table has been introduced a new subform (SystemDiagram). Therefore, update your expressions in order to integrate this new structure. So now, the click event of the button ResetForm code should look like this:
Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.rawValue = null;
Content.SystemDiagram.ImageDiagram.DiagramSub.Diagram.h = "0,6813 in";Paul
-
Scan multiple documents in a single file with HP advantage 3525
I want to scan several documents and save them in a file using the printer HP advantage 3525. It scans only one document and it must be savrd to a new file every time. How do I overcome this? Thank you
Hello
There are few options but please try first the builtin option. There is a small (+) sign after a click just + page to add another page... and at the end to record the entire session to a pdf file:
Kind regards.
-
How to scan multiple pages into a single file with a craving for hp 110?
I am running Win 7. I don't see an icon "+" in the screen of 110 envy of hp to be able to scan additional pages (such as the State of instructions online).
Thank you.
Hello
After the Scan, a Document dialog box or Photo reduce the resolution to 300 DPI or lower, the sign should appear in the preview screen.
Shlomi
-
How to scan multiple pages of a single document with the help of a 5530 want?
Under 'Advanced settings', tab 'File', the "Create a separate file for each scanned page" checkbox is NOT checked.
I tried to check the box and do a scan and then uncheck the box. no luck
Thanks in advance
I thought about it - apparently this software/mode particaulr does not believe allowing PDF files with high resolution (600 dpi or more) of multi page.
Thanks anyway
-
Hello world
I have a form with two sections. Each section is a subform (the green boxes represent subforms in the screenshot) and each subform contains three required fields and a release button (the button submit to an e-mail address). The problem is that I can't seem to keep them separate. If I fill in the fields required in Subform1 and then click on the button 'Submit to regional HR', he took over the fields required in the subform 2. Is there a way to 'point' or 'group' these fields to each Submit button in their respective subforms?
I can not be understanding the appropriate function or expects subform correctly. I learned designer of the life cycle on my own and with the help of this forum. Thank you very much for your help. -Chris
I'm an amateur, but I decided to start helping as much as possible on these forums.
I had a similar problem in the past and found a solution. I can't say with certainty that it is the best solution, but since each button has only 3 mandatory fields, it's a workable solution.
So this is complicated but also somewhat simple solution that works. Please keep in mind my script experience is limited.
For the first submit button allow the script to remain in its natural state. Make sure that your email presentation is correct. You will create a second button which will be a standard button. Change the text to be the same as the text for the first submit button. Within this button, the click event, puts a script like this.
(
If
Required.Field.1.rawValue == null or
Required.FIeld.2.rawValue == null or
Required.FIeld.3.rawValue is nothing
then
xfa.host.messageBox = ("If you please fill all required fields")
on the other
Submit.Button.execEvent ("mouseUp")
endif
Repeat this step for the second button on the subform.
now do the real hidden submit button and place the second button in its place. He will check the required fields have entered values and if they entered it will be then press the button to send real otherwise it will put in place the error message. This method requires that the mandatory fields are not marked as required by the value tab. They must be optional, if not built in scripts will interfere with the written order. This is a work around, but I found that it allows better control of the required fields. You can add a floating asterisk or perhaps a border coloured fields so that users are aware of what fields are mandatory.
I really hope this helps. I know this can be confusing, but I understand that sometimes it can be difficult to get a response, so if I can be useful, I'll try.
-
Convert multiple objects in grayscale in white with different alpha levels
So here's an interesting scenario: I have a few thousand tiny paths offer simple fillings CMYK. What I need, however, is to convert the CMYK value in white, but then hold the brightness by giving it transparency. I looked in all the menus and google all keyphrase I could think. Someone at - he never had to do something like that?
For me it looks like you use an opacity mask.
Select all the objects in grayscale and group them. Draw a white rectangle and put it behind the group. Select all, go in the transparency Palette and create an opacity mask. Invert the mask, if necessary.
Maybe you are looking for
-
Firefox won't open - taskbar icon looks active but won't display
Firefox does not open on the screen. The icon in my tray tasks shows a window, but the window does not open the monitor. I can RT. Click the icon and select Refresh, or maximize but no help. I'm under Win10. It also will not open on the screen when y
-
Cannot synchronize my mac with snow leopard 10.6 with my itunes on iphone
I use MacBook with Snow Leopard, version 10.6 and sync to my iphone with itunes 6. For these last months, the computer commented that the itunes on the iphone was not updated and cannot sync. But the itunes on the iphone is the latest version. Is the
-
Hi guys,. Thank you all for the help so far, I'm getting closer to the solution, but need help more. I'm trying to get an average value of my signals (I named the signals and in the field) and watch them on graph XY. Here https://decibel.ni.com/conte
-
Media Player, do not sync with iPod
I can't sync music on my ipod from media player
-
I get a white screen on my desk and a small spot of my picture I have for my Office I ran microsoft security scanner and it says no virus so how can I solve this