Get the last part of channels

Hello

I have a table as below

ID GroupName
TW product analyst EP 1
TW 2 SP Tech support analyst
THIS head of the Tech Support 3 TW
Manager of TW SP 4
5 another group without end with 2 characters
TW 6 MG product Coordinator


I would get just the last part of chains that ends by 2 characters (these 2 characters are States in the Brazil).
The query response should looks like below

ID GroupName
1 PE
2 SP
3
4 SP
6 MG

I appreciate any kind of help.

Thank you

Hello

Try:

SELECT  id
,       SUBSTR (group_name, -2)
FROM    table_x
WHERE   REGEXP_LIKE ( group_name, ' [^ ]{2}$');

In the second argument of REGEXP_LIKE
space has no special meaning; This means that the space character
[^] means anything except a space
{2} means exactly 2 of preceding
$ signifies the end of string
If the regular expression means "a space, followed by 2 nowheres, at the end of the chain".

Tags: Database

Similar Questions

  • Would it not possible to get the last part of Windows Vista CD key? Because the mine was demolished by the little brother, and I think he ate... (Yes small babies 7 months, what to do...) Eat whatever they can see...)

    I have 4 first parts of it and last segment 5 is missing... So, I think I can say the first 4 and get one last... I can even take a picture of him...

    Hello

    Microsoft puts the burden of proof on the Dell OEM, to solve the problem of a missing or damaged for a pre-installed operating system COA sticker.

    "How to identify, find and replace a product key.

    http://support.Microsoft.com/kb/811224

    «How to get a replacement product key»

    If the software is preinstalled on your computer, contact your computer manufacturer to obtain a replacement product key. »

    See you soon.

  • get the last day of the week

    Hi friends,

    I have the below query that returns me the data as below:

    Select 'Label', to_number (to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')) - to_number (to_char (add_months (sysdate,-6), 'IW')) + 1 as a weekly sum, (col1) val yyy_view
    where to_date(start_dt,'yyyy-mm-dd') between trunc (add_months(sysdate,-6)) and trunc (sysdate)
    Group of to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')
    order of to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')

    Label weekly val
    1 20 data
    2 24 data
    3 20 data
    4 28 data
    5 20 data
    6 24 data

    and so on...

    Now the requirement is to get the last date of the week for each week as below

    Label weekly val
    given 2011-08-30 20
    given 2011-08-23 24
    given 2011-08-16 20
    given 28 2011-08-09
    given 2011-08-02 20

    the weekly column should have the date of the last week. In the example above Wednesday is supposed to be the last date of the week.

    Kind regards
    Pradeep

    Missed the part "Wednesday is considered date of last week. The week is Thursday to Wednesday. If so:

    select  'Label',
             trunc(min(start_dt)) as day2,
            sum(col1 ) val
      from  yyy_view
      where start_dt between trunc(add_months(sysdate,-6)) and trunc(sysdate)
      group by trunc(start_date - 3,'IW')
      order by trunc(start_date - 3,'IW')
    /
    

    SY.

  • Firefox address field hide the last part of the address when loading.

    Firefox to hide the last part of the address entered when they were loaded.


  • During the upgrade of vista 64 bit, 7 64 bit process hangs about 2/3 of the way through the last part and I have to reboot that restores Vista.

    7 Windows vista upgrade problem

    During the upgrade of vista 64 bit, 7 64 bit process hangs about 2/3 of the way through the last part and I have to reboot that restores Vista. No idea what could be the cause of the crash?

    Hello

    I suggest you perform the steps in troubleshooting from the following link and check how it works.

    Upgrade stops responding (hangs) at 62% when you upgrade to Windows 7

    Check out the following link for more information about how to upgrade Windows Vista to Windows 7

    Upgrade Windows Vista to Windows 7

  • Installation of Windows 7 Home Premium 64 Vista Home Premium 64. It hangs on the last part of "transferring files, settings and programs.

    Install Windows 7 Home Premium 64 Vista Home Premium 64.  It hangs on the last part of "transferring files, settings and programs.  Before installation, the installation program tells me Logitech Quickcam 9.0.2 and Mirotune ATSC Capture Device was born to be unintalled.  But neither are installed that I can see.  What can I do?

    so eager to upgrade to Windows 7, it will depend on if the manufacturer of your computer/laptop has windows 7 drivers available for your computer/laptop as to whether Windows 7 will work properly on your machine

    check with them

    and read this

    Windows 7 upgrade advisor

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=1b544e90-7659-4BD9-9e51-2497c146af15

    Windows 7 system requirements

    http://Windows.Microsoft.com/en-us/Windows7/products/system-requirements

  • Where can I get the spare parts (circuit boards) for my HP 2509 m monitor?

    Where can I get the spare parts (circuit boards) for my HP 2509 m monitor?

    Hello tsmit32,

    Here is a link to the parts list of what HP considers to be user replaceable.

    Replaceable parts by the user (Europe, Middle East and Africa)

    Since the part is not on the list as a replaceable user then HP does not provide the part for sale. The circuit boards are going to be hard to find, perhaps ebay and other online retailers research is your best option.

    The other option that you have is to create your own heel to tear the other monitors that ppl may be getting rid of. If you can find a job of monitoring of 2509 m on ebay with a fairly cheap crack screen then you essentially buy the guts and that's what you're looking for.

  • How to get the last message received in the Inbox?

    Currently I am using the following code to the list of messages in the Inbox.

    Folder[] folders = store.list(Folder.INBOX);Folder inbox = folders[0];Message[] msgs = inbox.getMessages();
    

    But, how could I do the last message that was received in my inbox at the moment?

    I have a lot of unread messages in my Inbox and I can even receive the same message from sender twice at the same time, but I need access to the last message you received.

    Thank you

    As I have a implements FolderListener, I need to get the last message of FolderEvent object. But, I tried to access the last Inbox message, which will not always be there!

    Thanks Deepesh

  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • How to get the last business day of the previous month?

    Hi all

    We need the user as below,

    If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks

    Note:

    use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?

    TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))

    Thank you

    Deva

    Try this,

    case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end

    As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.

    Thank you

    AJ

  • I have been using Photoshop CS5 for some time for photos products (jewelry). What are my best options to get the last Photoshop.

    I have been using Photoshop CS5 for some time for photos products (jewelry). What are my best options to get the last Photoshop.

    Hi michaelb.

    You can subscribe to Plan photography for $9.99 a month, which will give the latest version of Photoshop CC 2015, CC 2015 Lightroom and Adobe Bridge.

    Lightroom and Photoshop | Plan of cloud of Adobe's creative photography

    Kind regards

    Mohit

  • How to get the last day of the weekend rather than a month

    Hi all

    Is the request appropriate and preferable to use to get the last business day of the month below?

    SELECT to_date('13.08.2014','dd.mm.yyyy') + MAX(RNUM) LastDay(nonweekend)
       FROM   (SELECT ROWNUM RNUM
              FROM   ALL_OBJECTS where rownum <=31)
      WHERE   ROWNUM <= 31 ANd
         TO_CHAR(to_date('13.08.2014','dd.mm.yyyy') + RNUM, 'DY','NLS_DATE_LANGUAGE=ENGLISH' ) NOT IN ('SAT' , 'SUN')
         and to_date('13.08.2014','dd.mm.yyyy') + RNUM <= last_day(to_date('13.08.2014','dd.mm.yyyy'))
    

    I have to use this motion for production.

    East - recommended to use?

    You can change your query this way:

    WITH t AS (SELECT trunc (to_date ('& calc_date', 'dd.mm.yyyy'), 'mm') + level - 1 calc_date)

    OF THE DOUBLE

    CONNECT BY LEVEL<= last_day(to_date('&calc_date',="" 'dd.mm.yyyy'))="" -="" trunc(to_date('&calc_date',="" 'dd.mm.yyyy'),="" 'mm')="" +="">

    )

    Select max (calc_date)

    t

    where to_char (calc_date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') NOT IN ("SAT", "Sun");

  • How to get the last day of a month for every 2 months for a given period?

    Hello

    Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?

    Thanks in advance.

    Try the below

    SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.

    SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1

    WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    END as lastweekday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    -(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).

    END as lastweekendday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7

    END AS lastmonday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • tried to get the last update. Update froze at 2%. Help

    Tried to get the last update. It froze at 2%. Any help much appreciated.

    Hello

    Go close before the creative Cloud Desktop Application and also all related processes for the same if it's windows, the Manager of tasks and activity monitor if it's the Mac.

    Very close to the AAMUpdater, Core Sync and IPCBroke process.

    So go ahead and uninstall the Cloud Desktop creative Application from the link below.

    Using creative cloud | Uninstall the creative cloud desktop application

    and install the above from the link below.

    https://creative.Adobe.com/products/creative-cloud

    Concerning

    Maansee

  • How to get the last row and the sum of all columns in a query

    Hello

    is there a way to get the last record for a column and the sum of all the Archives to another column in the same query.

    Best regards

    You must set your needs correctly volunteers to help here...

    Your data are not good enough to bring you a precise solution. Purpose, you do not have a column, which draws a distinction between the first and the last entry.

    The solution becomes easy based on your design.

    I introduced a grouping called 'id' column and a time column called 'time_of_insert' (only this way you can say with confidence that you can differentiate between the first and last (also a foolproof solution) - you can possibly use sequence (instead of date but if you say that you can insert two lines at the same time) ((and then likely sequence would be a better choice to differentiate instead of a timestamp field) etc...)

    With your sample data, something like this can be done to get the desired results.

    -----------------------------------------------------------------------------------------------------------------------

    WITH dataset AS

    (SELECT 1 id, 10 used, 8 remain, systimestamp + 1/24 time_of_insert FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 7, systimestamp + 2/24 FROM DUAL

    UNION ALL

    SELECT the id 1, 2, 5, systimestamp + 3/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 1, 0, systimestamp + 4/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 0, 0, systimestamp + 5/24 FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 4, systimestamp + 6/24 FROM DUAL)

    SELECT *.

    (SELECT SUM (used) ON sum_all)

    FIRST_VALUE (stay)

    COURSES (PARTITION BY id ORDER BY time_of_insert DESC)

    last_row

    Of THE dataset)

    WHERE ROWNUM = 1;

    Output:

    ------------------------

    SUM_ALL LAST_ROW

    ------------------------------

    15                  4

    See you soon,.

    Manik.

Maybe you are looking for