SEQUENCING WITH THE HELP OF SQL
HelloI have a requirement such as if my data is as follows
name identity
1 John
2 John
3 jane
4 jimmy
5 jimmy
Jack 6
I need a sequence that looks like
Name seq ID
1 John 1
2 John 1
3 jane 2
4 3 Jimmy
5 jimmy 3
6 Jack 4
and so on
So, I have a suspicion we can use analytics, but cannot set up a query to do this.
Sorry, it of a little naïve but would appreciate a hint...
Thank you
Birdy
Hi, Birdy,
Birdy says:
HelloI have a requirement such as if my data is as follows
name identity
1 John
2 John
3 jane
4 jimmy
5 jimmy
Jack 6I need a sequence that looks like
Name seq ID
1 John 1
2 John 1
3 jane 2
4 3 Jimmy
5 jimmy 3
6 Jack 4and so on
So, I have a suspicion we can use analytics, but cannot set up a query to do this.
Your right; analytical functions can do that. DENSE_RANK assign a number without gaps, duplicate output when the input is duplicated.
Do you care which name gets seq = 1 and who gets seq = 2? If this isn't the case, you can sort the names alphabetically:
SELECT id
, name
, DENSE_RANK () OVER (ORDER BY name) AS seq
FROM table_x
;
In the output you posted, it appears you want what they classified by the id low associated with each name ('Jean' = 1, 'jane' = 3 and so on). You can get the id low with the analytical MIN function:
WITH got_min_id AS
(
SELECT id
, name
, MIN (id) OVER (PARTITION BY name) AS min_id
FROM table_x
)
SELECT id
, name
, DENSE_RANK () OVER (ORDER BY min_id) AS seq
FROM table_x
;
Analytical functions cannot be nested. In other words, you can not say
... OVER (ORDER BY MIN (id) OVER ...)
That's why I used the got_min_id of the subquery.
Tags: Database
Similar Questions
-
print the currency compared with the help of sql - sum sum
I want to display summary amount for each ID with the motto inscribed on the amount as
1 US $60
2 GBP 30
create table t1 (id number, currency varchar2 (3), the number of quantity);
insert into t1 values (1, 'USD', 10);
insert into t1 values (1, 'USD', 20);
insert into t1 values (1, 'USD', 30);
insert into t1 values (2, "GBP", 5);
insert into t1 values (2, "GBP", 10);
insert into t1 values (2, "GBP", 15);
Thanks in advanceHello
Can be like that
SELECT id, currency || ' ' || SUM (amount) FROM ta1 GROUP BY id, currency;
see you soon
VT
-
Hi all
We have an obligation to state the previous year, current year and values of the year next as a LOV in the ADF page.
This is the query that retrieves the previous year, current year and next year. But the result of this query displays values in 3 columns:
Select (Extract(year from sysdate)-1), extract (year sysdate), (extract (year sysdate) + 1) twice;
Output:
2012 2013 2014
But I want to display them in a single with 3 rows as column:
2012
2013
2014
Please your ideas.
or in the same way
SELECT EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, 12 *(LEVEL-2)))
OF the double
connect by level<>
-
With the help of sql filter expression
Hi Experts,
I have a question using "sql expression" in the filters in the responses. Let's say I have a date filter and I wish that the value for this date as max (tablename.colname). Please tell me the syntax for this passage.
Another issue is that I have a date guest data are updated every week we'll tell the data refreshed like this * 01/08/11, 08/08/11 and 15/08/11 *. Now, if I select the 08/08/11 it will display the data
populated on * 08/08/11 * which is ok, but if I select * 09/08/11 to 14/08/11 * it only shows * 08/08/11 * data. Similarly, if the option * 16/08/11 or 16/09/11 * it should show the latest up-to-date data which is * 15/08/11 *.
Thanks in advance.
ChakOK, if that State is limited as of the last update when your selects a date in guest that is beyond / above the last refresh date.
This can be a way to do as below:
– Enter the last updated date in a variable repository. If this variable will always hold a value for the last date discount.
-In guests, capture the date selected by the user in a variable of presentation and to apply the Sub statement in SQL advanced report.DateColumn = case when Timestamp ' @{RBAP} {2011-01-01 00:00:00}'<= valueof("lastrefdate")="" then="" timestamp="" '@{pvar}{2011-01-01="" 00:00:00}'="" else="" valueof("lastrefdate")="">=>
RBAP following your presentation and lastRefDate var is your variable rep containing the last refresh date. What would this statement, if the user selects a date that is less than equal to the last refresh date, then report is filtered from this date. Otherwise, the report will be filtered by the value of the date of the last update.
Thank you
-
With the help of modulated signal pulse width (square wave) to control when a signal is enabled or disable
Hello all
I am using a modulated signal to labview created pulse width (square wave) to control when a signal is activated or not.
Here is my logic and a concrete example:
(1) the wave source signal is continuous
(2) use a PWM (square wave) created in labview to control when the signal is enabled or disabled
(3) if the PWM (amplitude) signal is superior to 0 play signal PWM is not greater than 0 do not play signal.I use actually this to the sequence step / pulse several distinct magnetic coils using my audio card (which has several channels of audio output), I have a signal in labview played constantly. As to compare it to the PWM (square wave) which controls whether or not the signal is played on each separate channel. That way I can control which coil is on and offshore and in what order they are activated.
I couldn't find an edge detection for a square wave created in labview, so I tried the limits, but it doesn't seem to work unless I change the phase manually and it only goes 1-1. I'm just trying to compare the PWM (edges of the square wave) already created by labview / play a signal if the pulse is greater than 0 and it shuts off the signal, if she is less than 0.
Should I do this another way
TIA
A waveform contains an array of values. You must check every value and respond accordingly:
-
- We discovered that the version of the SOUL of this notification is generated via a framework of OA.
- We have a requirement for the company to add details of the additional topics to the part of the notification. These fields are not standard for objects of view OA executives Business so an extension of necessary view.
- With the help of this and other sites, I was able to extend the view object in the favorite jDeveloper IDE and transfer it to my development OEBS instance.
- I see my view extended on the OFA Page, when you look at the content of 'About' from the page.
My problem is when I try to 'Customize' and add a column of extended view, errors Page OAF that I am trying to come back since the customization session.
I joined "Personalization_Error_when_adding_new_column_from_OA_Extended_view_object.docx" detailing what I try to run.
Support of Oracle said that extension of the view OFA is considered a "customization" and that he does not want to help.
Can anyone advise on what I should look at to solve this error?
Any feedback/assistance would be greatly appreciated.
Best regards
Rich
The View attribute is referred to as "LAST_UPDATE_DATE". If this is what we call in the SQL query, the attribute of the view object might be different like "LastUpdateDate". Please check back in the XXVO.xml.
If that has not solved the problem, its running diagnostics by activating the option FND:Diagnostics profile. Then you will get the link 'click here' link on the error page to get the error stack. You can stick the stack of error here.
Thank you
-
Problem with the process running sql
I created a pricess that deletes a file off of the table apex_application_files
When I run the following statement:
delete apex_application_files whose name like "resume.pdf" it works without problem
When I run the following statement:
delete apex_application_files whose name like ': P4_PDF_DISPLAY' he does not. what I have to do.
I changed the: p4_pdf_display to be a single item displayed on the page
With the help of the P4_PDF_DISPLAY can view the file in a query sql and beable to view the file to download, but am unable to delete
Help!Hello
>
I created a pricess that deletes a file off of the table apex_application_filesWhen I run the following statement:
delete apex_application_files whose name like "resume.pdf" it works without problemWhen I run the following statement:
delete apex_application_files whose name like ': P4_PDF_DISPLAY' he does not. what I have to do.I changed the: p4_pdf_display to be a single item displayed on the page
With the help of the P4_PDF_DISPLAY can view the file in a query sql and beable to view the file to download, but am unable to delete
>What is this point of P4_PDF_DISPLAY? It is the name of the file, as it is supposed to be in your delete statement? Or, view the article PDF?
Verify session state to display the value of the element. You see the name in it?See you soon,.
-
Insert the record of one table to another with the help of the cursor
Help, please!
the tables are - 1. countries (country_id pk, country_name, region_id)
2A (country_id, country_name, region_id)
table data are
1 to 1
2 b 2
3 C 3
NULL d 4
5 e 5
6 f 6
7 g 7
-----------------------
Insert the record in the table a country table with the help of the cursor, insert all the non-null records.
This procedure does not correct result
-----------------------
create or replace
Amit procedure as
cursor c1 is select * from a;
RW a % rowtype;
Start
Open c1;
Fetch c1 into rw.
While (C1% found)
loop
insert into countries values (rw.country_id, rw.country_name, rw.region_id);
commit;
Fetch c1 into rw.
If rw.country_id is null then
Fetch c1 into rw.
end if;
end loop;
Close c1;
exception
while others then
dbms_output.put_line ('exception = name ' |) RW.country_name);
end;You don't need cursor at all;
create or replace procedure amit as begin insert into countries (Country_ID, Country_Name, Region_ID) (select a.Country_ID ,a.Country_Name ,a.Region_ID from a ); dbms_output.put_line('Rows inserted : ' || sql%rowcount); commit; end; /
-
Hello
I currently have problems with the help of apex_item.select_list_from_query_xl in a select statement with a UNION in it. I have a region of type SQL report and my statement looks like:
SELECT apex_item.text (c004, 1, NULL, 10) val
Of apex_collections
WHERE collection_name = "TABS".
AND c002 = 'NUMBER '.
UNION
SELECT Apex_item.select_list_from_query_xl (1, c004, 'SELECT display_value' |)
'OF tab_select_list' |
"WHERE tab_column_sysid = ' |" C005) val
Of apex_collections
WHERE collection_name = "TABS".
AND c002 = 'SELECT LIST'
(Basically I'm trying to establish a relationship with a text element and a list of selection in there).
The problem is that some of my selection lists are more than 4000 characters long need to use the apex_item.select_list_from_query_xl. The error returned from the foregoing is ORA-01790: expression must have the same data type as the corresponding expression, which is fair enough as the apex_item.select_list_from_query_xl returns a clob and apex_item.text a varchar2. So I tried casting the apex_item.text on the type clob as follows:
SELECT to_clob (apex_item.text (c004, 1, NULL, 10)) val
Of apex_collections
WHERE collection_name = "TABS".
AND c002 = 'NUMBER '.
UNION
SELECT Apex_item.select_list_from_query_xl (1, c004, 'SELECT display_value' |)
'OF tab_select_list' |
"WHERE tab_column_sysid = ' |" C005) val
Of apex_collections
WHERE collection_name = "TABS".
AND c002 = 'SELECT LIST'
and now I get the error ORA-00932: inconsistent data types: expected - got CLOB, which is unexpected. Someone has ideas how to get around this?
Thanks in advance...Please we say your first name and add it to your forum profile to help us. Thank you.
Try UNION ALL instead of UNION.
Scott
-
My AirPort Extreme end not implemented with the help of AirPort Utility
Bought a used AirPort Extreme (Genesis 4) of a person who showed me that he worked at home. When I try to set up as a Wireless extender to my last existing AirPort Extreme, he will not carry out synchronization upward with AirPort Utility. It appears as a new extreme, but get a message 'unexpected error' before or after the name. Have you tried to reset the two while it is powered and turning the as explained in the help.
When I try to set up as a Wireless extender...
Gen 4 airport will connect to your existing AirPort Extreme wireless... or... it will connect using wired Ethernet wired, Permanent?
.. .it will not accomplish the synchronization upward with AirPort Utility.
Which version of AirPort Utility? If it's on your Mac... and you don't know what version you have...
Open AirPort Utility
Click the AirPort Utility menu in the upper left corner of the screen
Click on about AirPort Utility
Report on the version number you see here
You have an iPhone or a handy iPad that could be used to implement the 4th Gen airport if the problems continue with the help of your Mac?
-
Try to copy a text to paste in another. When I double tap, as I always have, all I get is a bubble with icons on it. With the help of OS 10.0.2.
maryml wrote:
Try to copy a text to paste in another. When I double tap, as I always have, all I get is a bubble with icons on it. With the help of OS 10.0.2.
Press and hold on the text and wait for the copy/more pop up.
-
With the help of Club running on the Nike watch +.
Hello
This is something I have tried to work for a while and have not yet been able to find an answer. At the moment I use Nike + management club on my iPhone to follow the tracks that I find that gps is better than just using the application of the workout on my watch. However, something that really bothers me is that I start the race on my phone, but I can't then view my stats while running without having to press on and tap the watch and wait for the application to load, very irritating to race. I want to be able to lift my wrist and live stats are there to watch me, not listening and not get my phone out of my pocket. Surely this is something that can make the original watch?
As a separate issue with the new app, Nike +, it does not recognize the songs I downloaded on my phone of Apple music in my playlists, then I have to play the separatelay of music through the application of music as opposed to go with Nike +? The ides on how to fix or is this a known problem with the latest Nike + app?
Hello
You may find it useful to consult the support resources of Nike and/or contact Nike for assistance with the help of their application:
- Contact Nike (support is available by phone and via social media):
- Nike + running Club to support:
More information:
https://iTunes.Apple.com/us/app/Nike+-run-Club/id387771637?Mt=8
-
With the help of old gear series noon on El Capitan
I have a Vox Tonelab SE effects audio Board (around 2004), there the old serial midi on the back ports. I hung with the help of a USB MIDI interface cable. While the USB Midi interface to the show in Audio / Midi set upward and also in the profile system for USB port it does not detect the Vox Tonelab so no communication lunch.
There is a POWERPC application called ToneLabSE SoundEditor which I downloaded and installed in the hope he would install a driver but I guess that this obviously doesn't work on INTEL in any case. Using Wine I can run the PC version, but still no communication via midi.
Someone at - it ideas, would like to get this Panel communicating effects via MIDI.
Thank you
Solved! Using the WINE app I've run the version of the PC of ToneLab SE editor application. So pretty unintuitively by changing the serial midi to USB, SERIAL interface cables that went to the and out on the Tonelab SE. Now of the Se ToneLab editor I can write banks of programs to hardware Tonelab, but unable to empty the banks since the material Tonelab to software. My main desire was to use Expression pedals on the Tonelab as Midi Ableton controllers and some of the switches to the control of the Looper stomp. Now I can do it all. Hooray!
-
With the help of Yosemite, I like Photos app in general; have big Aperture library, although I use rarely opening Tools. Advantages, disadvantages and pitfalls related to the migration of Photos?
Opening was a pro the Pro amateur-oriented or serious app, usually shooting Raw, probably on a digital SLR.
If that's you then pictures will miss a lot for you.
If this isn't the case, then opening was probably overkill for your needs.
If you like the pictures then this is the way to go.
-
With the help of Mac 10.9.4
If I open Thunderbird, I can connect to my e-mail address and download the messages. If I select "Get Mail" once again, Thunderbird crashes and fails to connect to my emails. If I then close Thunderbird and re-open it, I'm able to immediately connect to my mail.It seems to have sorted itself after a few days. (Fingers crossed). Until today it worked properly. Will keep an eye on things for the next week and the report does so again.
Maybe you are looking for
-
Tried to roll back to an earlier version without result. Seems that the new version has brought permanent changes to the system.
-
My Macbook Air keeps freezing, what should I do?
Hello! I got my Macbook Air a few months ago lately he randomly decides to freeze completely. My only way to use it is to restart to leave anywhere. I used EtreCheck and here is the diagnostics - if I could get a blocking understand I would really ap
-
Gray lines through the pictures
Hello I recently downloaded the photos from my iphone, and on them the Photos app preview, they showed with gray lines in the Center with a mini-apercu of the photo. This happened only in the first installment of 100 or more, and the rest of the pho
-
My PC Dell XPS401L has been updated to Win 7 Win 10. Then, the HP DJ1510_188 software has been installed. The task was ok until the bond required of the Dekjet to the USB port. Heard the noise of the acknowledgement of receipt, but there screen rema
-
Hello I was wondering if there is a way to combine the views of modules (a couple of State displays and a few slider control modules) in a single user interface. I know that this feature is available in labview, but haven't be able to find instructio