Help: "GROUP BY" with a "MAX"

Let me try to explain this one and thank you in advance for your help
tblA : PK_SID, Name, Status
tblB :PK_ID(AUTONUMBER), SID, Date
Tables are in a one to many. With SID being the common field. I am trying to write a select statement that will group data from tblA and show the MAX(last) date of that item from tblB
Example
TblA
PK_SID Name Status
1 Laptop Good
2 Monitor Excellent
3 Desktop Good
4 Printer Moderate
5 Phone Good
6 Router Excellent
7 Switch Good
tblB
PK_ID     SID     DATE
001 3     08/01/07
003 6 07/15/07
004     3 08/10/07
002 1 06/15/07
010 2 05/01/07
015 4     04/08/07
016 4 08/02/07
009 6 02/03/07
OUTPUT SHOULD BE
PK_SID Name Status      LASTDATE
1     Laptop Good      06/15/07
2     Monitor Excellent     05/01/07
3     Desktop Good     08/10/07
4 Printer Moderate 08/02/07
5 Phone Good          
6 Router Excellent 07/15/07
7 Switch Good          
So essentially I have grouped all my items from tblA and included the last date they were used
including those that were not used

SQL> create table tbla
  2  as
  3  select 1 pk_sid, 'Laptop' name, 'Good' status from dual union all
  4  select 2, 'Monitor', 'Excellent' from dual union all
  5  select 3, 'Desktop', 'Good' from dual union all
  6  select 4, 'Printer', 'Moderate' from dual union all
  7  select 5, 'Phone', 'Good' from dual union all
  8  select 6, 'Router', 'Excellent' from dual union all
  9  select 7, 'Switch', 'Good' from dual
10  /
Tabel is aangemaakt.
SQL> create table tblb
  2  as
  3  select '001' pk_id, 3 sid, date '2007-08-01' bdate from dual union all
  4  select '003', 6, date '2007-07-15' from dual union all
  5  select '004', 3, date '2007-08-10' from dual union all
  6  select '002', 1, date '2007-06-15' from dual union all
  7  select '010', 2, date '2007-05-01' from dual union all
  8  select '015', 4, date '2007-04-08' from dual union all
  9  select '016', 4, date '2007-08-02' from dual union all
10  select '009', 6, date '2007-02-03' from dual
11  /
Tabel is aangemaakt.
SQL> select a.pk_sid
  2       , a.name
  3       , a.status
  4       , max(b.bdate)
  5    from tbla a
  6       , tblb b
  7   where a.pk_sid = b.sid (+)
  8   group by a.pk_sid
  9       , a.name
10       , a.status
11   order by a.pk_sid
12  /
    PK_SID NAME    STATUS    MAX(B.BDATE)
         1 Laptop  Good      15-06-2007 00:00:00
         2 Monitor Excellent 01-05-2007 00:00:00
         3 Desktop Good      10-08-2007 00:00:00
         4 Printer Moderate  02-08-2007 00:00:00
         5 Phone   Good
         6 Router  Excellent 15-07-2007 00:00:00
         7 Switch  Good
7 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • Help! Problems with 845E MAX HSF seating

     have a MSI 845E MAX and a P4 2.8 GHz cpu. I bought a coolmaster L71 for 478 socket type but when I put it on the cpu, the four little plastic white pins that hold the HSF mounting tray in place prevents the HSF from actually connecting with the CPU unless I use a load on paste (which is wrong)
    If I take out the pins the HSF sits on the CPU fine but surley this cannot be correct? Has anyone else had this problem or have any ideas why?
    I have also tried a mates P4 S478 HSF and it does the same, the four pins seem to stop it touching the cpu correctly.
    Party

    What's up? I got your Email - I don't know about cutting those pins off. Man, that really sucks those heatsinks aren't fitting correctly. What would be wrong with getting a stock Intel fan/heatsink? They are really cheap. I saw one for $7 shipped. Or get the f/h I have. It's a Coolermaster D14-7H53D. However, if you want to try and cut those pins go ahead because you can always buy a new bracket if it doesn't work. Let me know what happens. Good luck.
    Man, you can't say (s)ucks in this forum.  

  • I can't make a group conversation with my friends help

    Ok so I tried to make a group conversation with my friends but it says it failed to send help!! idk if it's because one of my friends doesnt have an I phone but I don't think that's the problem because I could txt him in a seperate conversation. Then I asked my friend to make it and she did but I havent gotten any of the txts please help

    Hi Elle1018,
    Thank you for using Apple Support Communities.
    To troubleshoot this issue where you're unable to send or receive messages from a particular contact, please follow the steps in the article linked to below.
    iOS: Troubleshooting Messages - Apple Support
    Take care,
    Alex H.

  • Help , my contacts have disappeared, I only have Groups appearing with subtitle All contacts but none to be seen..what is this about? How can I recover them?

    Could anyone help, suddenly my contacts have disappeared, or at least I cannot access them anymore, al I have is a GROUPS screen with All Contacts underneath and...nothing else, it says no contacts...how can I find them again? Help

    I entered them directly into my phone. Two days ago, I plugged it into my mac and synced it with itunes, but i didn't sync the contacts and they were still in there after.

  • NEED HELP IN MATRIX WITH GROUP REPORT

    Dear All,
    I need small help in MATRIX WITH GROUP REPORT In Report Builder Test Report
    In my report, having periods as rows and location as columns as shown below,
    1) LOC-A
    JAN-10 FEB-10
    ITEM-GROUP -1 1 2
    ITEM-GROUP-2 3 4
    ITEM-GROUP 3 5 6
    2) LOC- B
    MAR-10 APR-10
    ITEM-GROUP -1 7 8
    ITEM-GROUP-2 9 10
    ITEM-GROUP-3 11 12
    But comming to my requirement, the periods should be in fix in matrix as shown below
    1) JAN-10 FEB-10 MAR-10 APR-10
    LOC-A
    ITEM-GROUP -1 1 2
    ITEM-GROUP-2 3 4
    ITEM-GROUP 3 5 6
    LOC- B
    ITEM-GROUP -1 0 0 7 8
    ITEM-GROUP-2 0 0 9 10
    ITEM-GROUP-3 0 0 11 12
    I am unable to get this kind of output format
    Please kindly waiting for reply from our team....
    Regards
    krishna.P

    For the periods, create a seperate dummy query and then use it as column group in the multi query matrix.

  • Help I can only have max. 3 osx apps. open at the same time ?

    Help I can only have max. 3 apps. open at the same time ?
    If I have 3 apps. open, and try to open a 4th. this message comes up :
    The application "Mail" cannot be launched. -10810
    Of cause if I'm trying to open up something else than mail, lets say iPhoto, it will say "iPhoto".
    This is very weird to me, and I'm normally pretty good at solving issues myself, but I'm stuck with this one.
    Please help out

    I've had this quite a lot too. Do you find that under these conditions you can't load a disk image either?
    At first I put this down to Rosetta taking up a lot of resources. I was running OmniWeb with a lot of pages open in the workspaces so I've switched back to Safari until OmniWeb is UB. This morning I read that having Windows file sharing switched on helps to cause this problem. I switched this off, rebooted and ran disk utility to repair disk permissions and I've been running OK since then. I've currently got 13 apps open plus Finder and Widgets. They include 2 bigguns, Eclipse/MyEclipse and Visual Paradigm for UML. It'll probably stop working now I've written that.
    I run a MBP 17 with 2GB memory. My guess is that Windows file sharing does cause problems. I just hope Apple has resolved this in 10.4.7... whenever that is.
    Gareth

  • In a group text with two phones that use Imessage and one that does not. The person that does not, does not get my message when its sent in group text. How do i fix this?

    I have a group text with two of my friends. here's each person break down
    person 1 ATT network, using imessage
    person 2 verzion network, using imessage
    person 3 verzion network, using SMS
    All three of us are in a group chat. When person 1 sends a message, person 2 recieves it, but person 3 does not. Then when person 3 sends a message, both person 1 and 2 get it. When person 2 sends an Imessage, person 1 and 3 get it
    so the problem is when person 1 sends an imessage, it doesnt change to sms and person 3 doesnt get it, but person 2's automatilly switches it to green.
    How can person one get their phone to automaticlly switch it to green in group message while keeping on imessage?

    The quote below from http://support.apple.com/kb/HT5760 indicates that it in the situation you describe it should be going as MMS to everyone -- which is not what you are seeing actually happen (and also not what you want to happen if I understand correctly). There may be something else helpful in the link.
    Group messages will be sent using iMessage if all recipients have iMessage enabled. If not, the conversation will be sent as MMS. Group messages use MMS even if the content is text only.

  • TS4040 I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs re

    I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs repairing. So I click on Repair, and once again I'm prompted for a password, which I enter, then the same error box opens, and so it goes. Can anyone help me with this problem? I'd greatly appreciate it.
    Thor

    Back up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Step 1 should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary, and if everything is working as expected after step 1.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Group Text with Android Doesn't Work

    Hi- I had been using an iPhone for a few years, and decided to switch over to Android. It took some time to get my phone number disassociated from iMessage/iCloud, but I was eventually able to get that done. Since iOS8 came out, though, I'm starting to experience problems again. Specifically, whenever I group text with multiple iPhone users, everything works fine -- until my wife (an iPhone 6 user) is added into the group. When this happens, everything automatically switches back to iMessage and I stop receiving any messages.
    Has anyone else experienced this? Are there any fixes?
    Thanks

    Just in case other people found my post by Googling, here is my fix I added to my post on the OpenOffice forum.
    Re: Text to speech only reads the document title  
    by Trish8 » Sat Feb 14, 2015 9:58 am
    I tried as many suggestions as I could from the plethora of suggestions above. I'm sure you are correct, it must be the Mac's problem. I took a chance and downloaded LibreOffice; Text to Speech now works the same as it does on TextEdit, the internet, and PdF. Thanks for all the help, I mean that sincerely. OpenOffice is a really fine product.
    Patt

  • Set "peoples or groups" field with current user "login name" in sharepoint list form using javascript

    hi friends
    i am trying to set peoples or groups field in sharepoint  list form with current user login name
    here my code
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function NewItemView () {
    var currentUser;
        if (SP.ClientContext != null) {
          SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
        else {
          SP.SOD.executeFunc('sp.js', null, getCurrentUser);
        function getCurrentUser() {
          var context = new SP.ClientContext.get_current();
          var web = context.get_web();
          currentUser = web.get_currentUser();
          context.load(currentUser);
          context.executeQueryAsync(onSuccessMethod, onRequestFail);
        function onSuccessMethod(sender, args) {
          var account = currentUser.get_loginName();
          var accountEmail = currentUser.get_email();
          var currentUserAccount = account.substring(account.indexOf("|") + 1);
        SetAndResolvePeoplePicker("requester",account);
    // This function runs if the executeQueryAsync call fails.
        function onRequestFail(sender, args) {
          alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
     function SetAndResolvePeoplePicker(fieldName, userAccountName) {
       var controlName = fieldName;
        var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
        var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
        var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
        peoplePickerEditor.val(userAccountName);
        spPeoplePicker.AddUnresolvedUserFromEditor(true);
    </script>
    but it is not working
    please help me

    Hi,
    According to your post, my understanding is that you wanted to set "peoples or groups" field with current user "login name" in SharePoint list form using JavaScript.
    To set "peoples or groups" field with current user "login name”,  you can use the below code:
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    function SetPickerValue(pickerid, key, dispval) {
    var xml = '<Entities Append="False" Error="" Separator=";" MaxHeight="3">';
    xml = xml + PreparePickerEntityXml(key, dispval);
    xml = xml + '</Entities>';
    EntityEditorCallback(xml, pickerid, true);
    function PreparePickerEntityXml(key, dispval) {
    return '<Entity Key="' + key + '" DisplayText="' + dispval + '" IsResolved="True" Description="' + key + '"><MultipleMatches /></Entity>';
    function GetCurrentUserAndInsertIntoUserField() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    this._currentUser = web.get_currentUser();
    context.load(this._currentUser);
    context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
    Function.createDelegate(this, this.onFailure));
    function onSuccess(sender, args) {
    SetPickerValue('ctl00_m_g_99f3303a_dffa_4436_8bfa_3511d9ffddc0_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_UserField', this._currentUser.get_loginName(),
    this._currentUser.get_title());
    function onFaiure(sender, args) {
    alert(args.get_message() + ' ' + args.get_stackTrace());
    ExecuteOrDelayUntilScriptLoaded(GetCurrentUserAndInsertIntoUserField, "sp.js");
    </script>
    More information:
    http://alexeybbb.blogspot.com/2012/10/sharepoint-set-peoplepicker-via-js.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • TS3276 how to send a group email with iPhone 5

    how to send a group email with iPhone 5

    I have a new OSX 27" iMac that is running Maverick. 
    RE: group emails, I am trying to omit individual recients and have tried the following options without success.
    1) Mail- Composing- checked "Automatically- Bcc"
    2) Mail- Composing- unchecked "when sending to a group, show all member addresses"
    The result is that all names continue to show up with email addresses for group emails.
    HELP!  HELP!  HELP!
    Lynn 

  • Finding the setup files for the help utility favorites menu and MAX configuration

    I have LabVIEW 2011 installed on my laptop, or it might be more accurate to say that I did have it installed until my computer crashed a few days ago and I am now trying to restore my information back into a new computer with a complete new install!  So, one of the things that I would like to do is to find the file that contains the "favorites" information in the help menu so that I can copy the file into the correct place so that the newly installed LabVIEW will populate the help file utility with the previous listing of the favorites in the help utility. Does anyone know where this file is installed and what it's name is? Also, it would seem that there is another file which I would sure know about for the configuration af the devices and tasks that were setup in MAX. So, does anyone know where this file is located so that I can have MAX configured the same as I originally had configured before my computer crashed?

    Hi Cuthbert,
    To be able to recover your MAX configuration you should try to follow the process of removing MAX Database Corruption.
    You can look for the path where the folders are in the computer that crashed and then copy those to the new computer.
    Regards,
    steve.bm
    AE | NI

  • Warning: There is no reporting group defined with a purpose of iRecruitment

    Hi,
    When i try to generate the offer letter in iRecruitment, i am getting the warning: There is no reporting group defined with a purpose of iRecruitment in "Enter compensation" Screen. However i am able to generate the offer letter,preview and submit the offer letter. I have referred the Article [ID 1168832.1] in oracle support. It suggest me to give the Temporary Directory file name using XML Publisher Administrator , but still the Warning appears.
    STEPS
    The issue can be reproduced at will with the following steps:
    1. From Vacancy Search page, select applicant.
    2. Create Offer: Enter Basic Details.
    3. Warning: There is no reporting group defined with a purpose of iRecruitment for this business group.
    4. Review page.
    Version Details: Oracle Applications : 12.1.2
    But still the offer letter is generated.
    Can anyone advice me to over come this warning
    Regards
    Suraysh

    I have the same behavior too. Looking at the iRecruitment implementation guide, I see reporting groups defined there.
    1) Select your HRMS Superuser responsibility
    2) Go to Total Compensation : General Definitions : Additional Setup : Reporting Groups
    If you see no data, it's likely you have ... no reporting groups.
    I think this time the error is pointing you in the right direction.
    I hope this helps.

  • How to update person or group column with peopleeditor control values

    Hi,
    I have created custom aspx page and added "PeopleEditor" control(can select multiple users)  in that page. Now I am trying to update person or group column with peopleeditor control values.I am not getting any error if I select single user
    in PeopleEditor control but getting error if I select more than one user.
    UpdateItem(listItem, "ListColumnName",
    listItem.ParentList.ParentWeb.EnsureUser(peopleeditorId.CommaSeparatedAccounts));
    Can anybody help me out to resolve the issue?
    Thank you in advance!!!
    AA.

    First get all the users/groups from the PeapleEditor by using PeapleEditor.ResolvedEntities
    foreach (PickerEntity pickerEntity in peopleEditor.ResolvedEntities)
    SPPrincipalType principalType = (SPPrincipalType)Enum.Parse(typeof(SPPrincipalType), pickerEntity.EntityData["PrincipalType"].ToString());
    if (principalType == SPPrincipalType.User || principalType == SPPrincipalType.SecurityGroup)
    string loginName = pickerEntity.Key;
    //your code here
    else if (principalType == SPPrincipalType.SharePointGroup)
    string groupName = pickerEntity.Key;
    //your code here
    Add all the users/groups in an instance of SPFieldUserValueCollection
    and then update your list item.
    SPFieldUserValueCollection users = new SPFieldUserValueCollection();
    users.Add(new SPFieldUserValue(web,user.ID,user.Name));
    item["YourUserColumn"] = users;
    item.Update();

  • Group message with 15 different people?

    [Topic title updated by moderator to be more descriptive. Original topic title was: "group message"]
    Is it possible to have group message with 15 different people?

    Hi and welcome to the Skype Community,
    You can have group chat conversations with up to 300 members. You can get the member count by using the "/info" chat command in a chat.
    Additionally you can have group video calls with up to 25 participants. Make sure you have enough internet bandwidth and a strong CPU for that though.
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

Maybe you are looking for