How can I apply this two query?

I have two employees from table to table and CSEReduxResponses

As part of table, I

CREATE TABLE [dbo].[employee](
  [emp_id] [int] IDENTITY(1,1) NOT NULL,
  [emp_namefirst] [varchar](255) NOT NULL,
  [emp_namemiddle] [varchar](50) NULL,
  [emp_namelast] [varchar](255) NOT NULL
) 

I react

CREATE TABLE [dbo].[CSEReduxResponses](
  [response_id] [int] IDENTITY(1,1) NOT NULL,
  [employee] [int] NOT NULL,
  [employeedept] [int] NOT NULL,
  [star] [tinyint] NOT NULL,
  [status] [int] NOT NULL,
  [approvedby] [int] NULL,
  [approveddate] [datetime] NULL,
  [execoffice_status] [int] NULL,


)

Im trying to get the employee with the execpffice_status of MAX (it's a 1 or 0).

I have this request I made for her

select top(1) with ties employee, SUM(execoffice_status) as 'total'
  from   CSEReduxResponses
  group by employee
  order by 'total' desc

my request for the employee table is

   select emp_namefirst as first , emp_namelast as [last]
  from phonelist.dbo.employee where emp_namefirst is not null

How can I get this request 2 together so I can output the name of the employee (first and last)

with the max exeoffice_status?

IM using

Microsoft SQL Server Management Studio10.0.2531.0

WRONG FORUM!

This forum is for Oracle - you must post in a forum of sql server.

Please mark the thread ANSWERED and repost in the appropriate forum.

Tags: Database

Similar Questions

  • How can I write this GREP query correctly (CS4)

    Hello.

    I have a, uh, interesting problem. I got a HUGE page layout document. copy typed in word... and have ' cleaned every regular:

    -to - and multi-retourne to the simple and so on.

    However, the editor has throughout the copy (by effect? LOL) decided to single space the letters of the words randomly in the text as follows:

    It is a E x a m p l e, of what he has done and is a massive p r o b l e m / e h a d a, c e h!

    Ok... I try to work on the proper GREP but have so far failed. What I need, is to find any space white between two simple letters and replace it with, well, to remove them. I'm into hysteria with myself as it seems so simple and yet I can not understand it.

    So, here I am enlisting the help of the GREP Boffins out there.

    Thank you sincerely

    Grant

    It would be: search

    (? <><\w) (?="\w\">)

    replacing it with nothing - assuming that these spaces, as Peter points out. It really could be followed as well. It's (I think) so a style German emphasis to the space of words (but not as big as a set of 'regular' space).

    You'd also better to check than if there are really just words at random, otherwise you will lose focus. If you want to mark the words with a character style, you cannot use the above GREP. Interestingly, I can not write a single GREP that removes the spaces and add a character style to the text at a time... But you can use the GREP

    \<\w( \w)+\="">

    with a character style in the replace with formatting field to mark any text with a style, and then remove the outdoor areas.
  • How can I fix this. REG QUERY "HKLM\SOFTWARE\Microsoft.

    HELP... Can someone please tell me what this means and how can I fix. REG QUERY 'HKLM\SOFTWARE\Microsoft NT\CurrentVersion\AppcompatFlags\UpgrapeExperienceIndicators' / v UpgEx: finderstr UpgEx ERROR: the system was unable to find the specified registry or the value key.

    How does this relate to the features of Windows Update (or recovery)?

    Did you mean "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\ExperienceIndicatorsUpgrade... » ?

    Is this a computer Win7 Pro or Ultimate?

    Is this the same computer (not the same problem) in one or two of these previous discussions of yours?...

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-windows_programs/Windows-feature/3dd93b2b-0500-4173-9e96-10021973d79d

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-update/install-updates/b1307f0b-cef4-48C6-a9f5-68063c270d0b

  • How can I perform this type of beach using DPL join query?

    How can I perform this type of beach using DPL join query?

    SELECT * from t where 1 < = t.a < = 2 and 3 < = t.b. < = 5

    In this pdf file: http://www.oracle.com/technology/products/berkeley-db/pdf/performing%20queries%20in%20oracle%20berkeley%20db%20java%20edition.pdf,

    It shows how to perform "Two motion equal on a single primary database" like SELECT * TAB WHERE A = col1 AND col2 = B using the join entity class, but it does not give a solution on the range join query.

    Right, you can only use an index for this query. If you do not need another index for another query, you might fall (remove @SecondaryKey).

    -mark

  • How can I make a cell formula will apply for the entire column? For example D2 appears B2 - C2. How can I copy this formula for each cell in the column?

    How can I make a cell formula will apply for the entire column? For example D2 appears B2 - C2. How can I copy this formula for each cell in the column?

    If you want the formula is the same (B2 - C2) in the cell of each column you must change it as ($B$ - 2$ C$ 2). Then copy it, select the whole column and paste.

  • I want to put two tables on a page with two columns how can I do this?

    I want to put two tables on a page with two columns how can I do this?

    It depends on what application you are using.

    If you use Word, then a good way would be to create a single table of 5 columns, check the borders of the invisible middle column so that it appears to be two separate tables.  You will need to do the same thing for unused cells downstairs as well.

    To get the best advice on Office-Word questions, use the forum not the Windows 7 Office forum that you do.  Look at the top of this page, just below the logo MS Answers and click on Forums , then select desktop. Once there, you can select Word.  By using the forum Office will give you a better chance to find a solution to your problem, as it is inhabited by people who know much about their topic.  Search the Forum of office for the topic, then, if no notice is found, ask your question here instead of this.

  • When work extra email acct, said I needed to allow windows apply security settings to this pc... How can I do this?

    When work extra email acct, said I needed to allow windows apply security settings to this pc... How can I do this?

    Wow, it worked a treat, thank you very much!

  • Hello. Recently, I buy the suite adobe for students. I also paid for two months. But in my profile it says I have a free plan for testing applications. And I can't get the entire application. How can I solve this?

    Hello. Recently, I buy the suite adobe for students. I also paid for two months. But in my profile it says I have a free plan for testing applications. And I can't get the entire application. How can I solve this?

    Your subscription to cloud shows correctly on your account page?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    If you have more than one email, you will be sure that you use the right Adobe ID?

    .

    If Yes

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    .

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • I can't apply a snippet of ActionScript to a button once a motion tween has been applied to the button. How can I do this?

    I can't apply a snippet of ActionScript to a button once a motion tween has been applied to the button. How can I do this?

    I use Adobe Flash Professional 15.0.1.179.
    My operating system is Mac OS x 10.11

    I am able to apply a snippet of code ActionScript for the button before you apply a Tween movement on the button; However, when I try to apply the snippet for the button after the motion tween has been applied, I am unable to do so. The action panel reads "Select a single image to apply or view script."

    Hi Robert,.

    That seems fine. You should be able to add code snippets at this stage.

    Try following the steps below:

    1. Select None (click somewhere on the empty area on the stage)

    2. click on frame 1 of your third layer. (be sure that a picture is selected)

    3 open the Code Snippets Panel, choose the desired code snippet and apply it. (the code must obtain added layer Actions.)

    If you write code manually, select frame 1 on the Layer 1 (shares) and add the code here.

    I hope this helps!

    Mabrouk

  • I have two photos... I'm taking a person who smiles on a photo and put it in the other photo where they do not smile. How can I do this?

    I have two photos... I'm taking a person who smiles on a photo and put it in the other photo where she is not smiling. How can I do this?

    Use Google or YouTube (smile Photoshop replacement) or (face Photoshop replacement).  For example: https://www.google.com/#q=photoshop+smile+replacement

  • How can I make this update, when I have two records (a primary key, no seq)

    How can I make this update in pl\sql
    Below is the table with data
    CREATE TABLE INSERT_TE
    ( 
    PIDM        VARCHAR2(8), 
    FORM_ID     VARCHAR2(2),
    TEACHER     VARCHAR2(30)
    )
    INSERT into INSERT_TE
    (
    PIDM,
    FORM_ID,
    TEACHER 
    )
    SELECT 
    '1106651', 
    'TE',
    'Teacher, Alber Howard' 
    from dual
    commit;
    INSERT into INSERT_TE
    (
    PIDM,
    FORM_ID,
    TEACHER 
    )
    SELECT 
    '1106651', 
    'TE',
    'Teacher, Alber2 ' 
    from dual
    commit;
    INSERT into INSERT_TE
    (
    PIDM,
    FORM_ID,
    TEACHER 
    )
    SELECT 
    '2321241', 
    'TE',
    'Teacher, Silly Billy ' 
    from dual
    Commit

    You're going to end with something like this: in a cursor...
    PIDM     FORM_ID     TEACHER
    1106651     TE     Teacher, Alber Howard
    1106651     TE     Teacher, Alber2 
    2321241     TE     Teacher, Silly Billy
    so I need to update a table

    If there is only one file like this 2321241 teacher YOU, Billy Silly
    no problem I'm
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC1'
    But if there's a PIDM (pk) with two records
    PIDM FORM_ID TEACHER
    1106651 TE Teacher, Alber Howard
    1106651 TE Teacher, Alber2 
    I need to make 2 updates (notice the rec1 sarchkl_admr_code AND for the firs and rec2 during the second
    The first record should update the table when the condition is sarchkl_admr_code = "REC1" and the second disc with the
    condition is sarchkl_admr_code = "REC2.
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC1'
    and
    UPDATE   saturn.sarchkl
             SET
             sarchkl_receive_date = SYSDATE,
             sarchkl_activity_date = SYSDATE,
             sarchkl_source = 'U',
             sarchkl_source_date = SYSDATE
             WHERE
              sarchkl_pidm = v_pidm3
              AND sarchkl_receive_date IS NULL
              AND sarchkl_term_code_entry = p_term
              AND sarchkl_admr_code = 'REC2'
    I do this in pl\sql, I don't have a sequence in the INSERT_TE table, how do I know that the first record in
    1106651 TE Teacher, Alber Howard
    1106651 TE Teacher, Alber2 
    updated a rec1 and the second updates when sarchkl_admr_code = "REC2."

    I guess I can create a sequence, but I'm inserting a table of a select statement, I get the error message
    ORA-02287: sequence number not allowed here, when I try to do the following:
     
     INSERT INTO SYTEACH
    ( 
    SYTEACH_PIDM,
    SYTEACH_ID,
    SYTEACH_TEACHER,
    SYTEACH_SEQ
    )
    SELECT   
          DISTINCT
          spriden_pidm, 
          sarchkl_admr_code, 
          szsform_form_id, 
          szsform_schl_off_type||', '||szsform_schl_off_firstname||' '||szsform_schl_off_lasttname teacher,
           SZSFORM_SEQ.NEXTVAL
            FROM   saturn_midd.szsform, saturn.spriden, saturn.sarchkl
           WHERE       spriden_ntyp_code = 'CAPP'
                   AND szsform_common_app_id = spriden_id
                   AND spriden_pidm = sarchkl_pidm
                   AND sarchkl_admr_code = 'REC1'
                   AND szsform_form_id = 'TE' 
     
    What is the simple way to make this update...

    Hello

    you said:

    >
    But if there's a PIDM (pk) with two records

    PIDM $FORM_ID TEACHER
    TE 1106651 teacher, Alber Howard
    1106651 TE, Alber2 Professor
    >

    Loc PKS are unique! (otherwise we don't call them pk)

    For your table, you can set a single like this:
    PIDM column + a sequence. (new heading):

    ALTER TABLE INSERT_TE ADD(TEACH_SEQ NUMBER)
    /
    
    UPDATE INSERT_TE x
       SET TEACH_SEQ =
              (SELECT n
               FROM   (SELECT ROWID rid,
                              ROW_NUMBER() OVER(PARTITION BY pidm ORDER BY TEACHER) n
                       FROM   INSERT_TE t) s
               WHERE  s.rid = x.ROWID)
    
    PIDM     FORM_ID     TEACHER     TEACH_SEQ
    1106651     TE     Teacher, Alber Howard      1
    1106651     TE     Teacher, Alber2       2
    2321241     TE     Teacher, Silly Billy      1
    

    I need to make 2 updates (notice the rec1 sarchkl_admr_code AND for the firs and rec2 during the second
    The first record should update the table when the condition is sarchkl_admr_code = "REC1" and the second record with the condition is sarchkl_admr_code = "REC2.
    >

    not normally.

    but you can do (now)

    select PIDM, FORM_ID, TEACHER, 'REC'||TEACH_SEQ TEACH_SEQ from INSERT_TE
    
    PIDM     FORM_ID     TEACHER     TEACH_SEQ
    1106651     TE     Teacher, Alber Howard     REC1
    1106651     TE     Teacher, Alber2      REC2
    2321241     TE     Teacher, Silly Billy      REC1
    

    and use the last column to update you...

    Published by: user11268895 on August 20, 2010 14:01

  • I have 2 phones on my ID Apple how can I keep the two devices to receive the same iMessages?

    I have 2 phones on my ID Apple how can I keep the two devices to receive the same iMessages?

    How to use several devices iPhone, iPad or iPod with a computer

    Using more an iDevice on the same computer

    This mainly applies to couples who add another device and don't want their electronic mail, messages, etc. being duplicated on both devices. To start reading: How to use several iPhone, iPad or iPod devices with one computer. You must create a login separate Apple and password for anyone who will use the new iDevice. See Apple - my Apple ID and frequently asked questions about the Apple ID. The easiest way is to do it on the computer using iTunes: iTunes - how to set up an Apple ID iTunes.

    On the computer, create a new user account for the person with the new iDevice. This is the user account always uses this person. He or she will no longer use the other user account. This way the person will have a separate iTunes library. Note When finished, do not 'share' apps under a single Apple ID. Each of you must buy your own applications under your own Apple ID. When you decide to divide like this you will have to buy new applications they want to use.

    First, transfer the new devices to a new account as well as all your data.  Save pictures of flow picture you want to keep for your camera (unless they are already in the camera roll) by opening your Photos app, tap Albums icon at the bottom. Now press the album My Photo Stream; Press Select; tap the photo you want to select. tap the share (box with the face up arrow) in the lower left corner icon; in the film, and then click Save.

    If you synchronize notes with iCloud, you want to keep, you must open each of your notes and email it to yourself. Later, you can copy and paste the text into the new notes created in your new account.

    Tap Settings > iCloud > remove account (removes it only from this device, not iCloud; the person who maintains the current account is not affected) provide the password to disable find my phone and choose to keep on my iDevice when prompted.  Sign in with another Apple ID to create your new account. Choose merge to download your data.

    Once you are on separate accounts, you can each go to icloud.com and remove data from the other person to your account.

    The above was created by the user randers4. Changes were made to improve the readability and the syntax.

  • How to create an animated title that scrolls like a classic title that is too large to fit on the screen of the iPod. How can I do this?

    I would like to create an animated title that scrolls like a classic title that is too large to fit on the screen of the iPod. How can I do this?

    < scratching head > long forgotten, how that will look like...?

    like in this video, around 00:40?

    https://Vimeo.com/11838765

    apply to your text moving or two keyframes and a mask behavior, I would say...

  • Windows 7. But the name of the account user each time before fully loading windows. How can I stop this and simply load in thank you Windows.

    I have just upgraded to Windows 7. But whenever I turn on my computer, he wants to support me on my user account name before completely loading windows. How can I stop this and simply load in thank you Windows.

    Hi UKuser7,

    Welcome to Microsoft Answers Forum.

    Automatic logon is disabled in Windows 7 by default for security reasons. If it is enabled, anyone who can physically access the computer can also gain access to everything on the computer, including the networks that it is connected.

    This setting is only recommended for cases where the computer is physically secure.

    To set up Windows 7 to connect to the desktop automatically, follow the steps below.

    1) click Start , and then enter the following command in the start search box:

    Netplwiz

    2) press ENTER.

    This opens the Advanced user accounts Control Panel window.

    (3) in the users tab, uncheck the box next to users must enter a user name and password to use this computer.

    4) click apply at the bottom of the user accounts window.

    (5) when the newspaper automatically on the dialog box appears, enter the user name for which you want to automatically connect to Windows 7. Then enter your password in the two areas where it is requested.

    6) click on the OK button.

    7) click OK in the window user accounts to complete the process.

    Thereafter, your PC at startup, Windows 7 will be automatically connect.

    Ticket back for your comments and concerns.

    Kind regards

    Shinmila H - Microsoft Support

    Visit our Microsoft answers feedback Forum and let us know what you think

  • How can I cut my two Gmail accounts with each other.

    Hello

    Whenever I connect to my Gmail account, I get the warning that there was a new sign from Firefox on Windows.

    I don't know why, but I get the same message on another Gmail account that I have not signed in to.

    In fact, on my mobile, I've set up these two Gmail accounts and I always switch between them.

    On my laptop, I always sign in to account by time, while on my laptop I am connected at the same time, all the time.

    How can I disconnect the two accounts, so that the e-mail, which belongs to the old, will not be sent to the latter, as well?

    I would like to disconnect them on my laptop and on my laptop.

    Thank you

    Francis UK

    Hello Francois,.

    Thank you for visiting Microsoft Community and we provide a detailed description of the issue.

    According to the description, I understand that you experience the problem when you try to connect to the Gmail account, you get the warning that there was a new GIS in Firefox on Windows. Now, you want to know how to disconnect the two accounts so that the e-mail which belongs to the former will not be sent to the latter.

    Certainly, I understand your concern and will try my best to help you.

    In order to get more help on this issue, you can post your query on the forum of Gmail. Please see the links below.

    https://productforums.Google.com/Forum/#! Forum/gmail

    https://support.Google.com/mail/?hl=en#topic=3394144

    I hope this information is useful.

    Please let us know if you need more help, we will be happy to help you.

    Thank you.

Maybe you are looking for