Merge two results in one line
Hello world... I think that it is a weighted question and I feel like if it was a little difficult to make, so if it's not meant to - let me know and I'll try to clarify or provide more concrete examples (if I can) :)I have a few indoor tables joined in my sql query - I post here all of the query, but it is long and will probably add a bit more confusion, so let's start by theorizing - where the results sometimes generate several lines. If several lines exist, I would take the smallest number in a field and the largest number in another area and display them on a single line.
For example, when I join the paintings of the PERIOD and SCHEDULE, the TIME table can provide two lines as follows:
SCHEDULE_ID PERIOD_ID START_TIME END_TIME
123 100 32820 35640
123 101 35940 38760
My end result should take the lowest START_TIME and END_TIME, the highest value even if they exist in separate lines.START_TIME END_TIME
32820 38760
It does not seem easy for me so if anyone can give a feel you deserve a reward. :) If I can give you some additional information, please let me know. Thanks for any help. Oracle 11gPublished by: nage62587 on 27 Sep 2012 11:32
You can get this depending on the group, if only these two columns are mandatory.
SELECT MIN (START_DATE), MAX (END_TIME) should work.
Kind regards
Julien
Tags: Database
Similar Questions
-
Syntax of content streams - two commands on one line
Hello
I developed PDF parser for partial application and it works for most PDF I need.
But recently I came across the piece of code that looks like this:
BT /T1 1 Tf 12 0 0 12 21.7323 769.5831 Tm (A)Tj -0.01 Tw 11.4 0 0 12 57.7323 769.5831 Tm [(P)25(od )35(...)]TJ 0.134 Tw -30.43 -1.056 Td 0 Tw (-)Tj 0.087 Tw T* ET
There are two commands on one line (Tw and Tm, Tw and Td, Tw and Tj, Tw and T * etc.) and Adobe Reader displays PDF file very well.
(1) how it is supposed to be threaded? First TW and Tm Tm, or seconds first (take 6 arguments and check if there is anything left) and Tw as second operation?
(2) where this situation is documented in the PDF reference? I want to check for general handling avoid another flaw in my application.
Thank you
The only requirement in a content stream is that there are some 'spaces' between operators and operands. If this space is a space, tab, line break, etc. belongs to the PDF producer. In more recent writers of PDF, there are NO jumps line (CR/LF) and only spaces.
(the exception to this rule is inline images)
-
How to merge two discs into one?
I recently updated my OS to Windows XP Edition Home Premium to Windows XP Pro. One way or another I have now two drives (Local 'C' and 'E' Local drive). When I start the computer it opens to E drive and I continually have a message that I don't have enough disk space on drive E. How can I megre present two discs into one? I tried to copy the contents of the C drive in drive E, but I get the message that I don't have enough space on this drive.
Recommendations or suggestions will be appreciated. Thank you.
Ernie...
Hi Ernie,.
I suggest you to follow these steps and check if the problem persists.
a. go to the start menu and open 'control panel '.
b. Select the option "System and Maintenance" If you use the Control Panel view home and 'Administrative tools' If you use the "classic" view
d. in the "Administrative Tools" section, select "format and create partitions on the disk.
e. for users "Classic view", select "Computer management" and select "Storage". Once finished, click on "disk management".
f. when the list of your reader, choose the one with which you want to merge your disk partitioned with (for example drive E :) and select 'Delete Volume'.)
g. therefore, select your C: drive and the option "Extend Volume". Your computer will automatically select the empty spaces available on your hard drive and you can change them if you want to do.Note: Make sure that you back up the data and then remove drive E.
-
Merge two favorite files - one of the former without losing new entries
I'm trying to move the Favorites from one computer to another, without losing the favorites that have been added to the second computer, which can ONLY be the first. Once I have export favorites from the first computer on a port USB, import replace simply all the Favorites on the second computer folder or it will ask me if I want to record a new one to the old double the second favorite of the computer file (like when you save jpg files).
Or is there another way to "merge" two folders, as visually opening upward both files and selecting what to switch to the hand...
Thanx
PS - am moving to Vista on a Windows 7 computer. as well as the synchronization of the two win 7 after that.
Hi Maril,
Thanks for posting your question in the Microsoft Community Forums.
Based on the information, you find out when you try to move the Favorites from one computer to another, if the existing Favorites in the second computer will be deleted.
Usually, when you import bookmarks to another computer, it will not replace the already existing bookmarks on the second computer.
However, to be on the safer side, you can take a backup of the bookmarks on the second computer to another folder or another location. Try favorites of the importation of the first computer to the second computer, check if you are able to access to existing favorites as well as any.
If this is not the case, try adding the Favorites of the backup location to imported Favorites and check if it helps.
You can also copy favorites from the second computer to the first computer and save it in a new folder. Try to create another folder containing the computer the two first and second Favorites and then import the Favorites from this folder to the second computer.
For more information, see the article:
Add, view, and organize Favorites
Hope the helps of information.
Let us know if you need help with Windows related issues. We will be happy to help you.
-
merge a result of one query with another
Hi all
I have a question that the result of the query should be considered as 1 column and the result of another
TABLE 1:
CREATE THE TEST_QUERY TABLE (EMP_ID, EMP_NAME VARCHAR2 (100), EMP_ROLE VARCHAR2 (100));
INSERT INTO TEST_QUERY VALUES (1, 'Jack', 'Dev');
INSERT INTO TEST_QUERY VALUES (2, 'Mike', 'Tester');
INSERT INTO TEST_QUERY VALUES (3, 'Steve', 'Support').
TABLE 2:
CREATE TABLE TEST_QUERY1 (NUMBER OF EMP_ID, EMP_NICK VARCHAR2 (100), EMP_VALUE VARCHAR2 (100));
INSERT INTO TEST_QUERY1 VALUES (1, 'ROLO', 'GOOD');
INSERT INTO TEST_QUERY1 VALUES (2, 'POLO', 'BAD');
INSERT INTO TEST_QUERY1 VALUES (5, 'ZHANG', 'POOR');
my request of intent:
SELECT count (p.emp_id), p.emp_id, q.emp_value, q.emp_nick test_query p test_query1 q where p.emp_id = group q.emp_id of p.emp_id, q.emp_value, q.emp_nick;
Because I need to use more than 100 columns in table TEST_QUERY1, to avoid adding more columns in the group by I thought I can take the result of the column of table 1 separately and the result of the columns in table 2, then combine the two to aid WITH the Clause, but it did not work
Query I wrote:
WITH P ACE (SELECT count (T.EMP_ID), T.EMP_ID OF TEST_QUERY T, TEST_QUERY T1 WHERE T.EMP_ID = T1. GROUP BY T.EMP_ID EMP_ID),
Q AS (SELECT S.EMP_ID, S.EMP_NICK, TEST_QUERY S.EMP_VALUE R, TEST_QUERY1 S WHERE R.EMP_ID = S.EMP_ID)
SELECT P, Q.* P, Q;
Please help me...
You took your idea too far. Yes, it is better to GROUP BY before the JOIN, but you don't need GROUP by your second 'query '.
Also, you left out the part of the join.
Assuming that I understand your question, here's something:
with P as ( select count(*) emp_id_cnt, emp_id from test_query group by emp_id ) select P.emp_id_cnt, P.emp_id, Q.emp_nick, Q.emp_value from P, test_query1 Q where P.emp_id = Q.emp_id;
-
Here, the title is a bit confusing, I completely realize that but here's what I'm trying to accomplish. I have a table with a column that repeats.
the table looks like this.
create table testCheck (check_num varchar2(20), amount number(17,2), invh_Code varchar2(20))
and it contains data as follows
INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('001', '50', '1123') INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('001', '50', '1123') INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('002', '100', '1234'
I would like to write a query that would give me of the separate check_num, but put an asterisk on the elements that are in fact double.
so in other words expected result in this case is as follows.
"CHECK_NUM" "AMOUNT" "INVH_CODE" "001*" 50 "1123" "002" 100 "1234"
I could go as far as getting unique values, but what I can't do, it is understand for the life of me how to put the asterisk in there.
Here's my query.
with Checkquery as ( SELECT count(*) over (partition by CHECK_NUM order by CHECK_NUM ROWS UNBOUNDED PRECEDING ) thiscount, CHECK_NUM, AMOUNT, INVH_CODE FROM TESTCHECK group by check_num, AMOUNT, INVH_CODE) select check_num, amount,invh_Code from Checkquery where thiscount ='1';
can someone tell me please in the right direction. I just want to identify the dups put an asterisk on the record and then only select records.
According to your last post, you keep what is displayed for the other columns, so why display them at all, so this will do the job.
SELECT check_num.
Decode (to_char (Count (*)), '1', NULL,'* ') dup_checks
TO define by test
GROUP BY check_num;
If you want to view the other columns, you have two choices. You must either put some sort of aggregate function in the list of selection, such as min, max, or sum, or they need to be part of the group.
Concerning
André
-
I'm looking for an effective way merge two PDF files: one with all the odd pages scanned a book, one with all even-numbered pages. This question has been posted several times in many different forums. I am unable to get the Javascript code that is given in the following forum to work. https://forums.adobe.com/thread/286654. Generally, the responses to this question are not useful for me because 1) they provide instructions that apply to an older version of Adobe (I use Adobe Acrobat Pro DC), or 2) they involve software purchase that I found to be ineffective. One post step by step to complete code that can do bonded labor and be registered as a custom through the command Wizard command (see the post from 11:27 January 13, 2016 to https://forums.adobe.com/thread/2063936, for an example of a good response to a different question) would be much appreciated. Thank you, Carl
You can use a large part of the script that was posted in the other thread and create a personalized out of it. In fact, it makes the script easier to understand, because all the "stuff" that is about adding menus and elevate the rights of scripts is no longer necessary.
See here for instructions on how to create a custom in Acrobat DC command:
Create orders customized in Adobe Acrobat DC Pro - KHKonsulting LLC
Instead of the sample code of the blog post, you would use this (which is really just a copy & paste of the original script):
// create an array to use as the rect parameter in the browse for field var arRect = new Array(); arRect[0] = 0; arRect[1] = 0; arRect[2] = 0; arRect[3] = 0; // create a non-visible form field to use as a browse for field var f = this.addField("txtFilename", "text", this.numPages - 1, arRect); f.delay = true; f.fileSelect = true; f.delay = false; // user prompted to select file to collate the open document with app.alert("Select the PDF file to merge with") // open the browse for dialog f.browseForFileToSubmit(); var evenDocPath = f.value; var q = this.numPages; var t = app.thermometer; t.duration = q; t.begin(); // insert pages from selected document into open document for (var i = 0; i < q; i++) { var j = i * 2; this.insertPages(j, evenDocPath, i); t.value = i; t.text = 'Inserting page ' + (i + 1); } t.end(); // remove unused field this.removeField("txtFilename");
Given the instructions in my blog, you should be able to create this custom command and run it. To run it, the important part is that you load the 'weird' part of the document first, then launch the custom command and then select the item "same" document.
-
Is it possible to merge 2 query results?
I have a function that returns a querey result.
< CFSET Temp = query1 >
< CFSET FNCTransfers = temp >
Now I want to change the query to return a query result merged
< CFSET Temp = query1 >
< CFSET temp2 = query2 >
Is it possible to merge two results?
Something like that (I know it cannot be like that)
< CFSET FNCTransfers = temp1 & temp2 >
Maby there should be a union and query of query?
The UNION could be the way to go. the results of the query must match
between 2 requests (the types must match for two field data queries)
SELECT * FROM query1
UNION
SELECT * FROM query2
Kruse says:
> Is it possible to merge 2 query results?
>
> I have a function that returns a querey result.
>
>< cfset="" temp="query1">
>
>
> Now I want to change the query to return a query result merged
>
>< cfset="" temp="query1">
>
>
> Is it possible to merge two results?
>
> Something like that (I know it cannot be like that)
>
>
> Maby there should be a union and query of query?
> -
How can I combine the two videos in one video in iTunes?
I was wondering how can I merge two videos into one on iTunes. I don't know how I can merge. Can you please show me how to merge the videos so I can add the video to my iPod? Thank you
iTunes can connect two videos. iMovie for iOS on iPod touch may be able to do it for you according to the format. Otherwise, there is a sequel called FreeStudio which probably has a tool for the job.
TT2
-
Merge two threads in the same person into one iMessage
I know that this issue has been addressed before. Most importantly, the discussion was on did not understand what the problem is.
So let me try to explain.
Tarzan has an iPhone and an iMac, Jane also has an ios device.
When Tarzan Jane sends an iMessage with his iPhone, Jane receives from "Tarzan" (the iMessage was related to his phone number)
Now, when Tarzan sends Jane an iMessage of its iMac, Jane receives from "Tarzan", but in a separate thread. (This iMessage was related to his email address)
Now Jane is in danger and she wants Tarzan to rescue her, she grabs his iPhone, opens the last conversation with Tarzan and Tarzan 'Help texts
But Tarzan in the jungle and he has only his iPhone with him.
Jane get killed because the imessage is sent to the iMac of Tarzan and not to his iPhone.
====
The problem is, you get two threads in the same person, are sent to the e-mail address associated with the iMessage, one for the phone number. But you can't see the difference between the two (except when you dig deep into the background-info).
If my suggestion of Apple is, they appreciate Jane's life, fix this problem soon: merge those two threads into one.
PeterSmith wrote:
I know that this issue has been addressed before. Most importantly, the discussion was on did not understand what the problem is.
So let me try to explain.
Tarzan has an iPhone and an iMac, Jane also has an ios device.
When Tarzan Jane sends an iMessage with his iPhone, Jane receives from "Tarzan" (the iMessage was related to his phone number)
Now, when Tarzan sends Jane an iMessage of its iMac, Jane receives from "Tarzan", but in a separate thread. (This iMessage was related to his email address)
Now Jane is in danger and she wants Tarzan to rescue her, she grabs his iPhone, opens the last conversation with Tarzan and Tarzan 'Help texts
But Tarzan in the jungle and he has only his iPhone with him.
Jane get killed because the imessage is sent to the iMac of Tarzan and not to his iPhone.
====
The problem is, you get two threads in the same person, are sent to the e-mail address associated with the iMessage, one for the phone number. But you can't see the difference between the two (except when you dig deep into the background-info).
If my suggestion of Apple is, they appreciate Jane's life, fix this problem soon: merge those two threads into one.
IMessage works as it should.
There is also no apple here to read your thread in this forum for a user to.
You can send your comments here http://www.apple.com/feedback/
If Jane was smart it would always send you an imessage using your phone number and not apple id. Here again, you can add your apple ID to imessage on your phone.
-
Need to align the two radio buttons in one line
Hi all
In my BlackBerry Application, I have a part of the user interface where I need to align two radio buttons in one line.
I used the code to design the user interface, but the two radio buttons below are overlapping.
SerializableAttribute public class BBSettingsScreen extends form {}
Rbg RadioButtonGroup = new RadioButtonGroup();
RadioButtonLayout raButtonLayout = new RadioButtonLayout();
raButtonLayout.add (new RadioButtonField ("ONE", rbg, true, RadioButtonField.FIELD_RIGHT));
raButtonLayout.add (new RadioButtonField ("TWO", rbg, false, RadioButtonField.FIELD_LEFT));Add (raButtonLayout);
SerializableAttribute public class RadioButtonLayout extends Manager {}
public RadioButtonLayout() {}
Super(Manager.VERTICAL_SCROLL |) Manager.RIGHTMOST);
}protected void sublayout (int width, int height) {}
Field field;
get the total number of areas falling under this Manager of
int numberOfFields = getFieldCount();
int x = 0;
int y = 0;
for (int i = 0; i)< numberoffields;i++)="">
field = getField (i); get the field
setPositionChild(field,x,y); set the position of the fieldlayoutChild (field, width, height); Spread the field
x += 30;
}width = 70;
height = 20;setExtent (width, height);
}}
}
Please help on this...
Thank you & best regards
Chintada Ravikumar
Try this:
RadioButtonGroup rgb=new RadioButtonGroup(); HorizontalFieldManager hr1=new HorizontalFieldManager(FIELD_HCENTER); RadioButtonField radioOne=new RadioButtonField(" RadioOne",rgb,true) { protected void layout(int width, int height) { super.layout(75,30);//Width and height according to the button name; setExtent(75,30);//width and height according to the button name; } }; hr1.add(radioOne); RadioButtonField radioTwo=new RadioButtonField(" RadioTwo",rgb,false) { protected void layout(int width, int height) { super.layout(75,30);//Width and height according to the button name; setExtent(75,30);//Width and height according to the button name; } }; radioTwo.setPadding(0, 0, 0, 20); hr1.add(other); add(hr1);
-
Merge two documents in files to PDF, into one?
Merge two documents in files to PDF, into one?
Hi antoniof33712361,
You can subscribe to the Adobe PDF package & use it will be Adobe Acrobat Reader DC to combine PDF files https://cloud.acrobat.com/combinepdf or you can purchase/subscription application Download Adobe Acrobat Acrobat products | Standard, Pro | DC, XI, X this feature.
Kind regards
Nicos -
Merge only one line on several lines
I need prepare a merge statement that merge only one line in a table. Here is the table definition, data instruction and fusion sample, I used.
Merge statement above will actually merge complete data. But I want that the first line will only get inserted to the base table (Mob_Main). If we take the "n1" name first row in the table with the ID Mob_Desc '10' should get only inserted. I go for a cursor to do what I have given huge volume, I prefer the merger instead.CREATE TABLE Mob_Attr (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20)); CREATE TABLE Mob_Desc (NAME VARCHAR2(50), ATTR_1 VARCHAR2(20), ID NUMBER(20)); CREATE TABLE Mob_Main (NAME VARCHAR2(20), ATTR VARCHAR2(20), ID VARCHAR2(10)); insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n1','aa',null,null); insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n2','bb',null,null); insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n3','cc',null,null); insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n4','dd',null,null); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',10); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',15); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',123); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',1455); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',455); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',135); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',15); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',52); insert into Mob_Desc (NAME,ATTR_1,ID) values ('n4','dd',1455); merge into Mob_Main ma using (select d.name, d.attr_1,d.id from Mob_Attr a, Mob_Desc d where a.name = d.name and a.attr_1 = d.attr_1 ) q on (ma.name=q.name and ma.attr=q.attr_1) when not matched then insert (NAME,ATTR,ID) values (q.name,q.attr_1,q.ID);
MERGE INTO Mob_Main ma USING ( SELECT distinct d.name, d.attr_1, first_value(d.id) over (partition by d.name, d.attr_1 order by d.rowid) id FROM Mob_Attr a, Mob_Desc d WHERE a.name = d.name AND a.attr_1 = d.attr_1 ) q ON (ma.name = q.name AND ma.attr = q.attr_1) WHEN NOT MATCHED THEN INSERT (NAME, ATTR, ID) VALUES (q.name, q.attr_1, q.ID); COMMIT; select * from Mob_Main order by name, id; NAME ATTR ID -------------------- -------------------- ---------- n1 aa 10 n2 bb 455 n3 cc 15 n4 dd 1455 4 rows selected.
-
simple way to merge two rows in a
11g 11.2.03
giveswith test_temp as (select 'x' key,to_char(1) col1,null col2 from dual UNION select 'x' key,null col1,'a' col2 from dual UNION select 'y' key,'a' col1,'b' col2 from dual UNION select 'z' key,'a' col1,null col2 from dual UNION select 'z' key,null col1,to_char(2) col2 from dual) select * from test_temp
smart way to get:KEY COL1 COL2 ----- ------- ------- x 1 x a y a b z a z 2
Essentially, I want to merge two lines based on a common key and remove all columns with NULL values, and merge them into a single line. The col1 and col2 can have any data types (number, char, date, etc.) ideas?KEY COL1 COL2 ----- ------- ------- x 1 a y a b z a 2
Published by: user13007502 on July 13, 2012 01:11
Published by: user13007502 on July 13, 2012 01:46
Published by: user13007502 on July 13, 2012 02:05
Published by: user13007502 on July 13, 2012 02:09user13007502 wrote:
Sorry guys. My example was not the best. The numbers are just one example. I expanded the sample to display more realistic data.I just want to know if there is a smart way to merge two or more lines according to a key. Line is merged only when the merged line will result in a single line.
So, as I said...
SQL> ed Wrote file afiedt.buf 1 with test_temp as 2 (select 'x' key,to_char(1) col1,null col2 from dual 3 UNION 4 select 'x' key,null col1,'a' col2 from dual 5 UNION 6 select 'y' key,'a' col1,'b' col2 from dual 7 UNION 8 select 'z' key,'a' col1,null col2 from dual 9 UNION 10 select 'z' key,null col1,to_char(2) col2 from dual) 11 select key 12 ,max(col1) as col1 13 ,max(col2) as col2 14 from test_temp 15* group by key SQL> / K C C - - - z a 2 x 1 a y a b
What is the problem you are having?
I feel that you don't even try the solutions proposed. Or well you're not giving us a pretty good example of what is the question.
-
I have a catalog covering the modified and modified files covering a period of time until the end of 2013. I have an another catalog covering the same period and the most recent files at the present time. The first changed files that have been made in a way not forward (the files were, but not mods) when I switched to a new machine and subsequently more photos for 2014 adds to the existing batch. I had never used XMPs to store the mods - my mistake, now corrected for the future. Is it possible to merge a catalog in another or both in a new catalog and keep the latest mods for all files? If not, can I export the changed files in a catalog, and then import them in the most recent two catalogues with all the included files?
I think that I found the definitive answer, in The Adobe Photoshop Lightroom book, the chapter on the merger of two catalogs into one. The trick is to create a new master catalog that starts in white, shoot in the first catalog (does not move the files), then it repeats with the second catalogue, which will search for and avoid the dupes, yet once again move the files. The end result is a catalog of master handset, with files and all changes for all files in the two catalogues. It worked for me. Thank you, you were thinking in the right direction.
Maybe you are looking for
-
completely remove a partition of the HD
I had my iMac a few weeks now and created a partition to put things that I wanted to keep away from the main road. Now, I decided to install windows 7 and possibly upgrade to windows 10. Problem! When I try to use Bootcamp to install it guard refuse
-
Windows XP SP3: Update KB2518864, KB2572073 and KB2633880
Something is obviously wrong in one or more encodings to the Microsoft Updates title, otherwise so many computers Windows XP would not have the problem "constantly repeat Windows Update" (AND it IS * A PROBLEM *). May I suggest to implement Microsof
-
New Firmware Bug - 1.02.26
To Sandisk... Have updated the new firmware and have found a bug. Earlier, I tried to delete a video. The video has been removed, but the entry (name) was still in the list. When I tried to play the deleted video once again the player has frozen. Had
-
Went to restore a laptop running slow friends to factory default and when it turned off and restarted, it asked me the admin password but it does not work. After 3 attempts, he gave me a code system is off of 93981032. Any help? Thank you.
-
HelloI am using Jdev 11 g and have created packages / classes that interacts with the API OPSS.I have several places forest implemented following is just an example...If (MYLOGGER.isLoggable (Level.FINE)) {}MYLOGGER(Level.FINE, CLASS_NAME, method .lo