Script for: Getting the closest price within the group

Hello
I need some help for my script.I would like to add new field . Do you guys have an idea any OLAP functions .
It was my simple script which doesn't give the answer I want.
SELECT
NO,
SUM_QTY,
QTY_QUOTED,
CASE WHEN QTY_QUOTED < SUM_QTY
THEN MAX(QTY_QUOTED)
WHEN QTY_QUOTED = SUM_QTY
THEN QTY_QUOTED
WHEN QTY_QUOTED > SUM_QTY
THEN MIN(QTY_QUOTED) END AS CLOSEST_Q
from table1
GROUP BY NO, SUM_QTY, QTY_QUOTED;
output for the script below:
No SUM_QTY QTY_QUOTED CLOSEST_Q
567     3     2     2
567     3     99     99
130     140     156     156
123     515     40     40
911     120     600     600
911     120     800     800
567     3     3     3
567     3     5     5
911     120     700     700
130     140     138     138
130     140     12     12
123     515     2     2
I would like to see the last field below:
No Sum_Qty Qty_Quoted The Field I want to have or  The other way I want to see
==== ======= ======== ================ ==================
123 515 40 x 40
123 515 2 40
567 3 5 3
567 3 2 3
567 3 3 x 3
567 3 99 3
911 120 600 x 600
911 120 700 600
911 120 800 600
130 140 12 138
130 140 138 x 138
130 140 256 138
I willl appreciate if you can give any clue /solution or idea.
Thanks a lot,
Pinar

[That script|http://discussions.apple.com/message.jspa?messageID=11012484#11012484] could change the Online Status of all mail accounts. The following one will just report their Online Status. Is this what you are (were) asking for?
--BEGINNING OF SCRIPT
tell application "Mail" to activate
tell application "System Events" to tell process "Mail"
set theMenu to menu "Mailbox" of menu bar 1
if enabled of menu item "Take All Accounts Online" of theMenu then
return "All accounts are currently offline"
else
return "All accounts are currently online"
end if
end tell
--END OF SCRIPT

Similar Messages

  • How to get the previous price of the  list price  in a order

    Hi All,
    I need to get the previous price of the condition type in an order  to calculate the %change of price.
    for ex: the conditon ZXXX has price 600 and its changed to 400 now .( by changing the quantity etc ).
    when the price value is changing to 400 , I need to capture  the value of 600 in another condition type.
    how can i acheive this ? Any idea?
    Please provide some pointers on it.
    Thanks in advance.
    Swapna.

    Hi Viraylab,
                     check  <b>VBAP-NETPR</b> field of table <b>VBAP</b>
    It gives the net price corresponding to a line item.
    Goto Tcode VA03.See the <b>item overview</b> tab U will get <b>Net Price</b> field for indivisual line item.
    Reward points if helpful.
    Regards,
    Hemant

  • I had a "pdf export" plan and upgraded it to "pdf pack" plan and it was charged the full price of the new plan in my credit card. How to get the refund of the non used part of the old plan?

    I had a "pdf export" plan and upgraded it to "pdf pack" plan and it was charged the full price of the new plan in my credit card. How to get the refund of the non used part of the old plan?

    Hi edilsoncf,
    I've seen your question on several forums, and responded there. Did you get your subscription sorted out?
    See: How do I get a refund if I have multiple Acrobat service subscriptions?
    Best,
    Sara

  • Get the current position within the PBEL Prozess

    Hi,
    In the BPELConsole I can see the the flow of every PBEL process
    instance and thus I see the current position within the process.
    How would you get the current position programatically, via SOAP e.g.?
    Kind regards,
    Martin

    Hi,
    there is a JAVA API provided by Oracle
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm
    If you really need SOAP, you can build your own Java webservices with this API

  • Hello. I have two version of Office for Mac. 2008 and 2001. I want to delete the 2008 version. If I use the removal tool within the Offie 2008 folder, is there any danger of the 2001 version being removed too.  Thanks Dave UK

    Hello. I have two version of Office for Mac. 2008 and 2001. I want to delete the 2008 version. If I use the removal tool within the Offie 2008 folder, is there any danger of the 2001 version being removed too.  Thanks Dave UK

    Do you mean Office 2008 and 2011 or do you really want Office 2001? I think you mean 2011 since Office 2001 wouldn't make much sense.
    The Office uninstaller should be able to identify there are two versions and allow you to delete either one or both.

  • I had a "pdf export" plan and upgraded it to "pdf pack" plan and it was charged the full price of the new plan in my credit card. How to get back the non used part of the old plan?

    I had a "pdf export" plan and upgraded it to "pdf pack" plan and it was charged the full price of the new plan in my credit card. How to get back the non used part of the old plan?

    Hi edilsoncf,
    I've seen your question on several forums, and responded there. Did you get your subscription sorted out?
    See: How do I get a refund if I have multiple Acrobat service subscriptions?
    Best,
    Sara

  • In the photo bin, what is the brush icon within the thumbnail for?

    In the photo bin, what is the brush icon within the thumbnail for?

    It means you have made edits but not saved them. At least, that is what it's supposed to signify.

  • When you have a list or blog within a box on a page, how do you get it to scroll within the box.

    When you have a list or blog within a box on a page, how do you get it to scroll within the box?

    Thanks so much!  Whatever I was trying only worked randomly. You made my day!

  • HT1349 What if I Tunes can't find the album artwork for some of my CDs' within the stoThere should be a way for it tore ?  download the album artwork anyway wheb downloading a disc ,should'nt there? My friend does it with all his CDs'. I cant' ask him tho

    What if I Tunes can't find the album artwork for some of my CDs' within the i-tunes store? There should be a way for it to download the Album Artwork automatically anyway ,shoild'nt there?My friens do it with all there CDs' but they moved.They do it with CDs' that i-tunes do'nt even know exist .I just can't figure it out .Any advice or help out there ?

    "If the content doesn't exist in iTunes then you can'd load artwork."
    If not in the iTunes Store, iTunes uses the Graceland database for artwork and tag info.

  • Script for getting mail if database is down

    Hi Friends,
    OS Version : IBM AIX 5,2
    Oracle version : 9.2.0.7
    I am executing the following script for getting mail alert if database is down. some how the script is not working
    check_stat=`ps -ef|grep ${ORACLE_SID}|grep pmon|wc -l`;
    oracle_num=`expr $check_stat`
    if [ $oracle_num -lt 1 ]
    then
    exit 0
    fi
    # Test to see if Oracle is accepting connections
    $ORACLE_HOME/bin/sqlplus -s "/as sysdba" > /tmp/check_$ORACLE_SID.ora
    select name from v$database;
    exit
    # If not, exit and e-mail . . .
    check_stat=`cat /tmp/check_$ORACLE_SID.ora|grep -i error|wc -l`;
    oracle_num=`expr $check_stat`
    if [ $oracle_num -ne 0 ]
    then
    mailx -s "$ORACLE_SID is down!" [email protected] < /tmp/check_$ORACLE_SID.ora
    exit 16
    fi
    I am saving this as .sh file and executing at command prompt. It is just hanging, but not throwing any error.
    I would like to know if there is anything to be modified in the script or please provide me any such script. Thanks in advance

    HI there.
    I have a script I use that works really well. It sends out an email only if the database is down and also reads an ini file to process a blackout period and a priority level of the database... High priority databases are monitored every 5 minutes and Medium priority databases every hour.
    There are two scripts, the shell script and the .ini file and I have two cron entries...
    Check script:_
    #!/bin/ksh
    # check_oracle_status.sh
    # Script to check if Oracle db's are up and running.
    # Script is passed a priority field and reads check_oracle_status.ini
    # to determine which db's to check. If db is down an email is sent.
    # Priority Levels:
    # H - Checks db's with "H"igh Priority every 5 minutes (cron)
    # M - Checks db's with "M"edium Priority every hour (cron)
    # L - db's with "L"ow Priority currently not checked
    # Script Change History:
    # ======================
    # October 29th, 2009 - Initial Creation
    # Set environment
    export SCRIPTHOME=/opt/oracle/admin/scripts
    export INIFILE=$SCRIPTHOME/check_oracle_status.ini
    export PRIORITY=$1
    . $HOME/.profile
    db=`grep -i ":$PRIORITY" $INIFILE | cut -d":" -f1`
    check_database()
    sqlplus <<! > $SCRIPTHOME/check.out
    / as sysdba
    select * from dba_data_files;
    exit
    grep ORA- $SCRIPTHOME/check.out > $SCRIPTHOME/error.out
    if (( $? )); then
    echo ""
    else
    mailx -s "Oracle instance $i is currently UNAVAILABLE" +<email address>+ < $SCRIPTHOME/error.out
    fi
    for i in $db ; do
    fields=`grep $i $INIFILE | awk -F':' '{ total = total + NF }; END {print total}'`
    export ORACLE_SID=$i
    if [ $fields -gt 2 ]; then
    BLACKOUT_START=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f3`
    BLACKOUT_END=`grep -i "$ORACLE_SID" $INIFILE | cut -d":" -f4`
    CURRENT_HOUR=`date +%H`
    CHECK_BASE=YES
    if [ $BLACKOUT_START -gt $BLACKOUT_END ]; then
    (( $CURRENT_HOUR >= $BLACKOUT_START || $CURRENT_HOUR <= $BLACKOUT_END )) && CHECK_BASE=
    else
    (( $CURRENT_HOUR >= $BLACKOUT_START && $CURRENT_HOUR <= $BLACKOUT_END )) && CHECK_BASE=
    fi
    if [ -n "$CHECK_BASE" ]; then
    check_database
    fi
    else
    check_database
    fi
    done
    rm $SCRIPTHOME/check.out $SCRIPTHOME/error.out
    INI File:_
    oracle1:L
    oracle2:M:17:08
    oracle3:M
    oracle5:M:17:08
    oracle6:H
    oracle7:M:17:08
    oracle8:M
    oracle9:M
    Where oracle1,2,3 etc is your sid
    L M and H your priority level
    17 is blackout start (5 PM)
    08 is blackout end (8 AM)
    Note: Blackout is just a start hour and an end hour and must contain both or none and my script can only process one blackout per database. I guess if you
    needed a second blackout you could add another line with different times for that sid
    Cron entries:_
    # Check Oracle Status
    # The check_oracle_status.sh script monitors "H"igh priority databases every 5 minutes
    # and "M"edium priority databases every hour
    0,5,10,15,20,25,30,35,40,45,50,55 * * * * /opt/oracle/admin/scripts/check_oracle_status.sh H > /dev/null 2>&1
    0 * * * * /opt/oracle/admin/scripts/check_oracle_status.sh M > /dev/null 2>&1
    Not sure if you require blackouts or priority levels but this setup works great at our site.
    Hope this helps.

  • Possibility to abort the execution from within the PreUUT and MainSequence

    Hello,
    This is probably a TS newbie question that most of you can answer right away!
    I'm using the sequential model to develop my test. I cannot figure out how to do terminate the execution from within the PreUUTLoop or MainSequence callback.
    In the PreUUT you can manipulate the parameter ContinueTesting to indicate to the process model that you want to stop testing.
    For the PreUUTLoop and MainSequence callback this parameter is not available.
    I could modify the process model itself to also supply me this parameter for the PreUUTLoop and the MainSequence. (and check for it on return from these callbacks)
    But, I was wondering, is there another (maybe even better) way to do this?
    Thanks for the help!
    noxus.

    Thanks, that's what I was looking for.
    One extra question:
    - From the PreUUTLoop callback it is working fine. (immediately stops the execution)
    - From the MainSequence callback I still get the popup message "Next UUT" or "Terminate". Can I avoid this popup message and just Terminate the execution? (preferably without modifying the process model)
    or, another alternative is that I disable the "Test UUT" entry point and only allow the user to select "Single Pass". Is that possible? Is it possible to disable the "Test UUT" entry point for the sequential process model?
    Message Edited by noxus on 02-22-2007 04:17 AM

  • When I go to the ITunes stores within the application, the interface is distorted.

    When I go to the iTunes store within the Windows application, I always see this.  It makes it very difficult to browse for content.  I can usually get to things I specifically search for.  This is consistent each time I install an updated version.

    Perhaps try the iTunes Store loads partially or returns "Error 306" or "Error 10054" section in the Specific Conditions and Alert Messages: (Mac OS X / Windows) section of the following document:
    iTunes: Advanced iTunes Store troubleshooting

  • The constitution of India (Full) app is shown as 170 rupees in the app store, but 280 rupees is deducted from my bank account.  Can anyone please confirm what is the actual prices of the app.

    The constitution of India (Full) app is shown as 170 rupees in the app store. Today I bought the app and  280 rupees is deducted from my bank account.  Can anyone please confirm what is the actual price of the app.

    It's listed in the store as 170. What shows on your email receipt and/or on your purchase history : if you log into your account on your computer's iTunes via the Store > View Account menu option you should then see a Purchase History section with a 'see all' link to the right of it, if you click on that link your purchases should be listed with the most recent above the list.
    And did you add or change the credit card details on your iTunes account when making the purchase ? If you have then each time that you do so a small temporary store holding charge may be applied to check that the card details are correct and valid and that it's registered to exactly the same name and address as on your iTunes account - it should disappear off your account within a few days or so.
    Store holding charge : http://support.apple.com/kb/HT3702
    If you have been overcharged for the app then try the 'report a problem' page to contact iTunes Support : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Can you suggest a group messaging app where recipients can't see all the phone numbers within the group?

    Can you suggest a group messaging app where recipients can't see all the phone numbers within the group?  My friends are complaining that they can see all the people in the group; also when I get a response from some in the group, it comes to me ane many others in the goup - its like they've replied all. 
    Any help would be appreciated.
    iPhone 4; iOS5

    Sorry it hasn't worked out for you. I threw together a simple project that uses rectangles to represent your Bike and wheel groups. They all animate across the canvas in the bike group and the wheels rotate. I have attached screen shots so you can see how they are constructed.
    This image showsthe bike group where the orange rectangle and green circle represent the frame. The white rectangles represent wheels and the green and red rectangles I threw in to represent a wheel that has multiple objects in its group as your wheels do.
    Here the animation across the screen has started and notice all wheels rotating and staying with the frame.
    Again a little further down the timeline.
    I put this one in so you could see the group bounding box around the red and green wheel Good luck with your restart on this project and I hope these screen shots are helpful.

  • Power shell script for get a content db for a particular web application

    Hi
    what  is the power shell script for get a content db for a particular web application
    Get-SPDatabase 
    adil

    try this one
    Get-SPContentDatabase -webapplication http://url
    this will return all the database for the web applications.
    Get-SPContentDatabase -site http://contoso.com
    this will return the database name in which the contose site collection is.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

Maybe you are looking for

  • Macbook Pro 2014 (16gb ram) running very slow in excel.  Can anyone help?

    My Macbook Pro 2014 is running extremely slow in Mac Excel 2011.  I just recently made the purchase (Last week) to upgrade from my Macbook Pro 2013.  The upgrade was for work as I handle large spreadsheets in my new role.  It would take some time to

  • Work around for Excel "Array Formula" in Numbers?

    I have an Excel spreadsheet which I have built over many years to manage maintenance tasks of my boat. I would like to convert this to run on Numbers. Unfortunately I can't find a work-around for Excel's "Array Formulas". The column headers of my spr

  • 10.6.8 to 10.8

    can i update from 10.6.8 to 10.8

  • IPad Air and Soulseek

    Hello Apple users I'm thinking of getting the iPad Air but am wondering about Soulseek program. It runs on Macs, but will it run on an iPad? Lets say I download the same program version as it is for Macs and then install it on the iPad. Will it run a

  • Mac OS X Lion - Announced monday 7th June?

    Does Steve Jobs announce the new operating system monday 7th june? Thank you for any answers! P.S: English is not my main language...