Qry with non aggregate cols and not in group by clause too.

Hi all,
This is the table.
PROFILE_ID_NO WORK_OK_CD CREATE_DT
7041086 Y 2003-10-07-10.56.42
7041086 Y 2003-10-05-10.56.42
7041086 null 2003-10-06-06.58.08
7041086 N 2004-09-30-05.08.22
I want a qry to pick a profile_id_no and work_ok_cd where create_dt is maximum. I tried
select profile_id_no, work_ok_cd , max(create_dt) from profile group by profile_id_no, work_ok_cd
It gave 3 rows . I dont want that.
I want only the last row to be displayed. How to do that?
Pls help me write this qry .
Thanks
Jaya

user13743192 wrote:
I want a qry to pick a profile_id_no and work_ok_cd where create_dt is maximum.
...Setup:
create table profile (
  PROFILE_ID_NO number
  , WORK_OK_CD  varchar2(1)
  , CREATE_DT   date
alter session set nls_date_format = 'YYYY-MM-DD-HH.MI.SS';
insert into profile values (7041086, 'Y',  '2003-10-07-10.56.42');
insert into profile values (7041086, 'Y',  '2003-10-05-10.56.42');
insert into profile values (7041086, null, '2003-10-06-06.58.08');
insert into profile values (7041086, 'N',  '2004-09-30-05.08.22');
commit;What if there is another row that ties the maximum CREATE_DT?:
insert into profile values (9999999, 'Y',  '2004-09-30-05.08.22');Would you want all rows that match the maximum or only one. If you want all rows, maybe use?:
SQL> select PROFILE_ID_NO, WORK_OK_CD, CREATE_DT
  2  from PROFILE
  3  where CREATE_DT = (select max(CREATE_DT) from PROFILE);
PROFILE_ID_NO W CREATE_DT
      7041086 N 2004-09-30-05.08.22
      9999999 Y 2004-09-30-05.08.22Otherwise, use one of Frank Kulash's queries above, although the first query (using "DENSE_RANK") gives:
PROFILE_ID W CREATE_DT
   9999999 Y 2004-09-30 05:08 amand the second gives:
PROFILE_ID_NO W CREATE_DT
      7041086 N 2004-09-30-05.08.22

Similar Messages

  • I would like to be reached at my iMessage with my mobile number and not my email address

    I would like to be reached at my iMessage with my mobile number and not my email address

    If you're finding that iMessage & Facetime is showing your email as default & your number is greyed out so can't select it then try signing out of iMessage & Facetime & signing in again.

  • Can i use iCloud keychain with my own passwords and not with what is assigned and stored?

    Can i use iCloud keychain with my own passwords and not with what is assigned and stored?

    tammersalem wrote:) <-HDMI-> (HDTV)
    My main concerns are:
    -If I use iTunes on my main computer, will it then be available to Apple TV?
    -If I use Apple TV to download will it be available to my Main computer?
    -Can the Apple TV use a media server for storage over LAN (using NTFS Samab or otherwise)?
    Basically iTunes feeds AppleTv with media either syncing (copying to it) or streaming live.
    Media must be compatible with AppleTV.
    AppleTV requires a proper iTunes instance running - it cannot access a NAS directly.
    If you store media in a folder on a NAS and it's part of the computer iTunes library (just stored on the NAS vs internal/external drive), then when running iTunes makes this content available to AppleTV.
    Data will travel:
    NAS > network > iTunes > network to AppleTV
    As the path is potentially slower than internal/external attached drive > iTunes > network > AppleTV, it may or may not work robustly for streaming.
    If AppleTv is set to sync (it can also stream in this mode), when you purchase direct on AppleTV, the media should sync back to where the itunes library is stored (via iTunes) to keep things in sync and to allow you to backup the media.
    You cannot drag/drop media to/from AppleTv across the network, nor can it directly access storage itself - iTunes is an essential cog in the wheel.
    The majority of commercial 'in-built iTunes media servers' will not work directly with AppleTV as it has to be 'paired' with iTunes by entering a numerical code in iTunes and does not simply see 'shared libraries'.

  • I fixed the problem with the whole 'waiting' and not loading but now some of my apps won't open, what can I do?

    I fixed the problem with the whole 'waiting' and not loading but now some of my apps won't open, what can I do?

    - Try a reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Purchase/install any new app
    - Try the remaining items of:
    iOS: Troubleshooting applications purchased from the App Store

  • I updated my iPhone 4S weeks ago and today it said I needed to update it again, so I did. Now when I send iMessage it comes up with my email address and not my number. How do I fix this?

    I updated my iPhone 4S weeks ago and today it said I needed to update it again, so I did. Now when I send iMessage it comes up with my email address and not my number. How do I fix this?

    The Snow Leopard 10.6 DVD should still be available from Apple for $20. You will have to call Apple Customer Care 1-800-692-7753 or 1-800-676-2775 to purchase it. It may still be in the Legacy Products list. The App Store which is required to download 10.7 or 10.8 is part of the 10.6.6 update.
    If they no longer have any in stock you will have to buy it from eBay or Apple resellers that still have stock. But you will have to pay a premium since the DVDs are no longer being made. Snow Leopard DVDs are already up to $100 on Amazon.
    http://www.ebay.com/sch/i.html?_nkw=10.6+snow+leopard&_sacat=0&_odkw=mac+os+10.6 &_osacat=0

  • I just bought a new laptop because my old one died.  is there any way to sync my phone with the new machine and not lose all my data?

    i just bought a new laptop because my old one died.  is there any way to sync my phone with the new machine and not lose all my data?

    Copy everything from your backup copy of your old computer to your new one.
    Then sync.

  • TS4006 My phone will not turn on, therefore I have received a replacement phone but am wanting to reset my old device. It is not locating it because it says it is offline however I cannot turn it on at all. Can I start with my new device and not reset the

    My phone will not turn on, therefore I have received a replacement phone but am wanting to reset my old device. It is not locating it because it says it is offline however I cannot turn it on at all. Can I start with my new device and not reset the old? Any help would be greatly appreciated. It's been a week without a phone

    That does happen.  It depends on how hard the server is being hit, as well as the connection speed of your system.  If you are on a windows system, you will want to disable any antivirus or firewall software during the download.

  • Select columns not in group by clause

    Hi Guys,
    I want to fetch columns from a table which are not in group by clause. The catch here is that I also need a count and decode column..
    SELECT col_A, col_B, decode(col_C, '10', '10', '26', '26', '00') col_CT, col_X, col_Y count(*) CNT
    FROM TABLE_T
    WHERE col_B IN (100,101,102) AND col_C IN ('44','45','10','26')
    GROUP BY col_A, col_B, decode(col_C, '10', '10', '26', '26', '00')
    ORDER BY col_CT
    Since, col_X and col_Y are not in GROUP BY clause, it throws error. Also, decode/count of the columns makes it more complex.
    Please help me on this.
    Thanks,
    Amy

    Hi, Amy,
    Welcome to the forum!
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statments, relevant columns only) for all tables involved, and the results you want from that data.
    Always say which versionof Oracle you're using.
    How to do what youy want depends on what you want, which is unclear.
    If you say "GROUP BY a, b, c", that means you only want one row of output for each distinct combination of a, b and c. How do x and y fit into that? Do you want a separate output row for each distinct combination of a, b,c, x and y? Then add x and y to the GROUP BY clause. If you don't want separate rows for each combinataion of x and y, what do you want when a group has more than 1 value for either of them?
    You can simplify the code a little by doing the DECODE in a sub-query; then you can use the alias col_ct as many times as you like in the main query. That will make the code easier to maintain, too.

  • [SOLVED!] On USB drives, problems with non-English chars and HAL

    Hello,
    I am having a problem with non-English caracters (áãàçéẽê...) on files stored on my USB drive.
    On Windows they're created with the correct name. But on Linux the files have the non-English characteres replaced by '?' and are not accessible.
    If I manuallly mount the drives using 'mount -o iocharset=utf8 /dev/sdb1 /media/usbdisk' the characters are OK, so I think I just need to get HAL to pass the correct parameters to mount. However I don't know how to do that, and haven't found any good solution.
    I tried to build a custom kernel setting the default charset as UTF-8 and it didn't work.
    Any ideas? I'm using x86-64, HAL 0.5.13-3 and my locale is pt-BR.UTF-8.
    Thanks!
    EDIT: Actually, this is not a HAL problem, but a problem with 'exo'. For the solution, I edited /etc/xdg/xfce4/mount.rc and added iocharset=utf8 to the [vfat] category.
    Last edited by Renan Birck (2009-11-28 20:54:23)

    I don't use Thunar presently, but I looked in the Thunar Volume Manager doc and I didn't find anything to change the mount options of removable drives. I am not quite sure if it's possible or not. Maybe someone using it can tell for sure.
    But if it is not possible to change the mount options, a possible solution is to disable the Thunar Volume Manager plugin and to use something else more configurable to manage the automount function.
    Personally I use the halevt package from AUR which uses configuration files in the xml format.
    It's not so easy to use but is highly configurable.
    But there exists other tools also.
    I can help you with halevt if you choose that way...

  • Playlists containing songs with titles starting with non-alphabetical characters do not get transferred at all

    I was really happy about how the desktop manager lets me choose the songs from my itunes library by playlists! this is smart! I'm also happy to see the playbook render asian characters properly (unlike my experience on the bold!)
    However, I have a lot of songs which have titles that begin with non-alphabetical characters, ie asian characters. For all playlists which contains such songs, those songs do not get transferred onto the playbook AT ALL. For example, I have one playlist which contains only songs with titles beginning with asian characters - this playlist was transferred but it is shown as containing zero songs! When I browse my song library by artist/album, I can find all those songs that should be in that/those playlists.
    Can this be fixed?
    thanks.
    Solved!
    Go to Solution.

    as it turns out, it kind of got fixed by itself. what i did (i think, since i have not definitively verified) was i went to browse "all songs" wherein i noticed all thoses songs starting with asian characters seemed to show correctly. then i went back to the playlists in question, and viola!
    clearly there is a bug or two in the music player somewhere regarding these title characters. but rim has more urgent things to resolve i guess - like my auto screen lock is still not working!

  • Live upgrade - solaris 8/07 (U4) , with non-global zones and SC 3.2

    Dears,
    I need to use live upgrade for SC3.2 with non-global zones, solaris 10 U4 to Solaris 10 10/09 (latest release) and update the cluster to 3.2 U3.
    i dont know where to start, i've read lots of documents, but couldn't find one complete document to cover the whole process.
    i know that upgrade for solaris 10 with non-global zones is supported since my soalris 10 release, but i am not sure if its supported with SC.
    Appreciate your help

    Hi,
    I am not sure whether this document:
    http://wikis.sun.com/display/BluePrints/Maintaining+Solaris+with+Live+Upgrade+and+Update+On+Attach
    has been on the list of docs you found already.
    If you click on the download link, it won't work. But if you use the Tools icon on the upper right hand corner and click on attachements, you'll find the document. Its content is solely based on configurations with ZFS as root and zone root, but should have valuable information for other deployments as well.
    Regards
    Hartmut

  • Capture Now with Non-Controllable Device and Timecode from deck

    Hi,
    Trying to replace a windows laptop using premiere during our events.
    The mentioned system will allow me to get audio/video/timecode all through firewire from the deck AND allow me to "capture now" as a non-controllable device.
    I have not been able to find out how to do this with FCP6. I am able to get the timecode I need, but only with the "controllable" device settings I have thus far tried, at which point a "capture now" gives me an error message stating that the tape has ran out (or something of the sort)
    With "Non-Controllable Device" selected, I can "capture now" but the slot where the deck's timecode had been located is completely gone and no timecode was recorded on any of the test clips I tried.
    Thanks,
    Jeff

    Hi -
    I'm confused.
    The DSR 45A only has one firewire port, if you are plugging your computer into that to source the video, where is the video and timecode source feeding the DSR-45A coming from?
    Within the DSR 45A there are internal menu selections that specify the timecode behavior of the DSR-45A, are these menu settings correct?
    If you load a pre-recorded tape into the DSR-45A can you control the deck, and successfully capture from it as a controlled device from your FCP computer?
    You said:
    we have main deck, a backup deck and a dvr deck recording the primary feed. the capture now stuff is extra bonus!
    What are the formats of these decks? Is the timecode feeding the DSR-45A coming from one of them?
    Thanks
    MtD

  • Insert CLOB values problem with 9.2 drivers and not with 10

    Hi
    We are using Oracle 9.2.0.5. We need to insert values bigger than 4000bytes using thin connection, so we've decided to use CLOB fields. With the 9.2.0.5 driver we can't do it, obtaining the classical exception explaining the data is bigger than the supported size but with the 10g driver (and, of course, same java code) it worked. The problem is that we want to mantain the equivalence between the database and driver not using the 10g driver with the 9.2.0.5 version of the db.
    Here it's the test code we've used:
    Data generation:     
              String data = "";
              Random rnd = new Random();
              long cont = 10000;
              while (cont > 0){               
                   int result = rnd.nextInt(255);
                   data = data + result;
                   cont--;
              Integer id = new Integer(2);
    Data insertion:
                   String queryString="INSERT INTO TMP_BUG_ORACLE (ID, VALOR) VALUES (?,?)";
                   preparedStatement = connection.prepareStatement(queryString);
                   preparedStatement.setInt(1,1);
                   preparedStatement.setString(2,this.datos);
                   int numero = preparedStatement.executeUpdate();               
                   System.out.println("Items inserted: " + numero);
                   preparedStatement.close();
                   connection.close();
    Table structure
         Name:          Type:
         ID           NUMBER
         VALOR      CLOB
    Response (only with 9.2.0.5 driver):
    java.sql.SQLException: El tamaño de los datos es mayor que el tamaño máximo para este tipo: 25708 (Data size is bigger than the maximum for this type: 25708)
    Thank you very much for all

    Hi,
    I had exactly the same problem. on Oracle 9.2 I wanted to insert a template file bigger than 4K. with the ojdbc14.jar from Oracle 9.2 it was not possible.
    What I did was this:
    I have used a JDBCwrapper to fix this issue. I can send it to you, if you send me your email.
    When I use the ojdbc14.jar from Oracle 10, I cannot insert a bigger file.
    How did you code your programm to insert big size data into a CLOB field with ojdbc14.jar driver from 10?
    thank you for your response

  • Why does my 3rd gen ipad only charge with an iPhone charger and not the 10w charger it came with?

    Im only asking this because it's annoying me , but my 3rd gem ipad will not charge with its 10w charger ? It will happily charge with my iPhone charger, and my iPhone will happily charge with the 10w charger but why won't the ipad charge with the charger it came with ? Any ideas ?

    The cable for your 10W charger may be defective.

  • Assignment field in FB03 is updated with a TM PO, and not the material PO

    Hi Experts,
    I am facing an issue.
    Issue: The assignment field in accounting document generated during GR is updated with the TM PO number(Trade PO) and not the Material PO .
    this happens while Posting goods receipt in VL32N tcode.
    Please let me know what can be the issue.
    Thanks and regards,
    Meenakshi Raina

    Everytime we create a TM PO , the error occurs in account assignment the first time you do the Good issue.
    If you reverse the document and repost the Good Issue it works the correct way

Maybe you are looking for

  • Validate xml against xslt

    i have a mapping with custom xslt. how to test against an input xml file? how to debug the xslt by giving the input xml file as input?

  • Family share can't open notifications on any machine

    My son is sending over family share ask to buy requests and I am unable to open them on any of my devices. Have tried on my iPhone 6, my macbook air and my macbook pro. What gives?? Frustrated mom and frustrated kiddo here.

  • How to make sense of the multiple photo subfolders in my iphone?

    I used to manually copy and paste newly taken photos from my iphone into my computer. Ever since I bought iphone 6, there is suddenly an onslaught of subfolders created, with seemingly no patterns how the photos and videos are sorted. I am now unable

  • T&E Task TS20000130 (Set trip status to approved) - pernr locked errors

    We are using a delivered task (TS20000130 - Set trip status to approved) in our T&E approval workflow.  Since moving this to production, weu2019ve experienced intermittent cases where the workflow step completes with an error because the pernr is loc

  • Alternate Text in a Figure Tag

    Is there a control, option, or preference that can be toggled on or off for when the alternate text in a figure tag shows when the cursor is hovering over an image in a tagged pdf? I am trying to get it so that the alternate text does NOT show when t