Need help with min max sql

hi all, forgot i had a user name and password and haven't needed help for quite a bit since i didn't do sql for a while but now i'm back at reporting again...
Here is a sample table as i remember it:
Item     Date     Time     Time Frame     Duration     Duration Frame
A     20100926     0     5     500     10
A     20100926     600     10     500     30
A     20100926     1500     12     100     30
B     20100926     1800     28     200     40
B     20100926     2200     6     150     70
B     20100926     2600     15     600     60
B     20100926     3600     30     200     70
Results Set (expected):                         
Item     Date     Time     Total Duration          
A     20100926     0     1600:20     --basically max (time+duration) - min(time+duration)     
B     20100926     1800     2000:00
Sorry, but. I didnt put my sql statement as I wasn't planning on posting and left it at work, but, i've been looking on internet and people say to use min/max function and i've attenpted it with it works with just this table (without grouping). But as soon as i group it the values seem to mess up.
Last i remembered it gave me:
Item     Date     Time     Total Duration          
A     20100926     0     1600:30     --basically max(time+duration) - min(time+duration)     
B     20100926     1800     2000:70
I think it's looking at max duration which is 30&70 and hence it retrurns those values in the result set. Is it because of the max function hence it's returning this value? any help is appreciated. thanks
Edited by: stanleyho on Sep 30, 2010 4:44 PM

Okay, here we go again, repost, hopefully okay this time:
Hi Madhu, okay, just got to work: I am using TOAD and working in Oracle 10g. Here is my table structure and the query i use to try and get what I am looking for:
There is one extra table but that is only used to link these two tables listed below so i didn't bother posting it.
TABLE: TX_RECON_INSTANCE_VIEW
ColumnName ColID DataType Null
CHANNEL_CODE 3 VARCHAR2 (4 Char) N
DURATION 8 NUMBER (10) N
DURATION_FRAME 9 NUMBER (2) N
REAL_TIME 6 NUMBER (10) N
REAL_TIME_FRAME 7 NUMBER (2) N
ITEM_ID 4 NUMBER Y
TX_DATE 2 CHAR (8 Byte) N
TX_ID 1 NUMBER (9) N
TX_TYPE 13 VARCHAR2 (4 Char) N
TABLE: TX_SCHEDULE
ColumnName ColID PK Null DataType
TX_TYPE 22 N VARCHAR2 (4 Char)
TX_ID 1 1 N NUMBER (9)
TX_DATE 2 N CHAR (8 Byte)
SCHEDULE_TIME_FRAME 9 N NUMBER (2)
SCHEDULE_TIME 8 N NUMBER (10)
REAL_TIME 10 N NUMBER (10)
DURATION_FRAME 13 N NUMBER (2)
DURATION 12 N NUMBER (10)________________________________________
And the data and results:
TX_ID TX_DATE REAL_TIME REAL_TIME_FRAME DURATION DURATION_FRAME ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION SCHEDULE_TIME SCHEDULE_TIME_FRAME DURATION_1 DURATION_FRAME_1
1651000 20100710 0 0 545 20 1234 00:00:00:00 00:09:05:20 00:00:00:00 00:09:05:20 0 0 545 20
1752223 20100710 667 12 281 7 1234 00:11:07:12 00:04:41:07 00:11:07:10 00:04:41:07 667 10 281 7
1846501 20100710 1071 13 335 9 1234 00:17:51:13 00:05:35:09 00:17:50:09 00:05:35:09 1070 9 335 9
2001102 20100710 1525 6 249 14 1234 00:25:25:06 00:04:09:14 00:25:22:08 00:04:09:14 1522 8 249 14
3246669 20100710 1800 0 586 2 1235 00:30:00:00 00:09:46:02 00:30:00:00 00:09:46:02 1800 0 586 2
4456822 20100710 2492 16 276 5 1235 00:41:32:16 00:04:36:05 00:41:32:16 00:04:36:05 2492 16 276 5
1253168 20100710 2890 15 222 17 1235 00:48:10:15 00:03:42:17 00:48:10:15 00:03:42:17 2890 15 222 17
1112456 20100710 3277 18 297 0 1235 00:54:37:18 00:04:57:00 00:54:35:10 00:04:57:00 3275 10 297 0
Grouped results set:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:20
20100710 1235 00:30:00:00 00:29:34:17 00:30:00:00 00:29:32:17
--> SCHEDULED DURATION "00:29:31:20" is not correct as it should be (00:25:22:08+00:04:09:14)-(00:00:00:00)=00:29:31:22
--> see expected results below
Expected results:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:22
20100710 1235 00:30:00:00 00:29:34:18 00:30:00:00 00:29:34:10________________________________________
And the query I am using:
SELECT --TXR.TX_ID,
TXR.TX_DATE, TXR.ITEM_ID,
TO_CHAR(TRUNC((MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "AS RUN TIME",
to_char(trunc((MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME_FRAME+TXR.DURATION_FRAME)-MIN(TXR.REAL_TIME),60),'FM00') "AS RUN DURATION",
TO_CHAR(TRUNC((MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "SCHEDULED TIME",
to_char(trunc((MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),60),'FM00')||':'||to_char(mod(MAX(TXS.DURATION_FRAME),60),'FM00') "SCHEDULED DURATION"
FROM TX_RECON_INSTANCE_VIEW TXR, TX_SCHEDULE TXS, TX_SCHEDULE_RECON TXREC
WHERE TXR.TX_DATE=20100926 AND TXR.TX_TYPE='P'
AND TXR.TX_ID=TXREC.RECON_TX_ID(+)
AND TXREC.BASE_TX_ID=TXS.TX_ID(+)
GROUP BY TXR.TX_DATE, TXR.ITEM_ID
ORDER BY TXR.TX_DATE, TXR.ITEM_ID, MAX(TXR.REAL_TIME)--does this work for everyone now? let me know...thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Need Help with Formula using SQL maybe

    I need help!  I work with Crystal reports XI and usually manage just fine with the Formula editor but his one I think will require some SQL and I am not good at that.
    We are running SQL 2000 I think (Enterprise Manager 8.0)  Our sales people schedule activities and enter notes for customer accounts.  Each is stored in a separate table.  I need to find activities that are scheduled 240 days into the future and show the most recent note that goes with the account for which that activity is scheduled.
    The two tables, Activities and History, share the an accountID field in common that links them to the correct customer account.   I want to look at dates in the Startdate.Activities field more than 240 days in the future and show the most recent note from the History table where the accountid's match. I figure my query will contain a join on AccountID.Activities and AccountID.History used with Max(completedate.History) but I do not understand how to word it.
    I would like to perform all this in crystal if possible.  I humbly request your help.
    Membery

    You SQL would look something like this...
    SELECT
    a.AccountID,
    a.BlahBlahBlah, -- Any other fields you want from the Activities table
    h.LastComment
    FROM Activities AS a
    LEFT OUTER JOIN History AS h ON a.AccountID = h.AccountID
    WHERE (a.ActivityDate BETWEEN GetDate() AND DateAdd(dd, 240, GetDate()))
    AND h.HistoryID IN (
         SELECT MAX(HistoryID)
         FROM History
         GROUP BY AccountID)
    This method assumes that the History table has a HistoryID that increments up automatically each time a new comment is added... So a comment made today would always have a higher HistoryID that one made yesterday.
    If I'm wrong and there is no HistoryID or the HistoryID doesn't increment in a chronological fashion, it can still be done but the code is a bit more complex.
    HTH,
    Jason

  • Need Help With Basics of SQL

    Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.
    1. How to create synonym for tables?
    2. How to describe the structure of tables?
    3. How to list the contents of tables?
    4. How to create a table named with the same structure as another table?
    5. How to copy rows with less than a certain criteria in value (e.g. Price<$5.00) into another table?
    6. How to change the data type to e.g. NUMBER(6)?
    7. How to add a new column named with data type e.g. VARCHAR2(10)?
    8. How to change a specific field within a table (e.g. For ORDER_NUMBER 12489, change the C_NUMBER to 315)?
    9. How to delete a specific row from a table?
    10. How to declare a column as the primary key of a table and call it e.g. PK_something?
    11. How to show certain columns when another column is less than a certain criteria in value (e.g. Price<$5.00)?
    12. How to show certain columns with another column having a certain item class e.g. HW or AP?
    13. How to list certain columns when another column e.g. price is between two values?
    14. How to list certain columns when another column e.g. price is negative?
    15. How to use the IN operator to find certain columns (e.g. first and last name of customers who are serviced by a certain ID)
    16. How to find certain columns when one of the columns begins with a particular letter (e.g. A)
    18. How to list the contents of the a table sorted in ascending order of item class and, within each item class, sorted in descending order of e.g. price?
    19. How to do a count of column in a table?
    20. How to sum a column and make rename is something?
    21. How to do a count of a column in a table (without repeats e.g. if a certain number repeats more than once than to only count it once)?
    22. How to use a subquery to find certain fields in columns when the another column’s fields values are greater than e.g. its average price?

    848290 wrote:
    Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.To use the terminology you have in those questions, you must already have a basic understanding of SQL, so you have exposed yourself as not being the author of such questions.
    Please do not ask homework questions without having at least attempted to answer them yourself first and show where you're struggling.

  • Need Help with Creating the SQl query

    Hi,
    SQL query gurus...
    INFORMATION:
    I have two table, CURRENT and PREVIOUS.(Table Defs below).
    CURRENT:
    Column1 - CURR_PARENT
    Column2 - CURR_CHILD
    Column3 - CURR_CHILD_ATTRIBUTE 1
    Column4 - CURR_CHILD_ATTRIBUTE 2
    Column5 - CURR_CHILD_ATTRIBUTE 3
    PREVIOUS:
    Column1 - PREV_PARENT
    Column2 - PREV_CHILD
    Column3 - PREV_CHILD_ATTRIBUTE 1
    Column4 - PREV_CHILD_ATTRIBUTE 2
    Column5 - PREV_CHILD_ATTRIBUTE 3
    PROBLEM STATEMENT
    Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
    I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
    Please help.
    Regards,
    Parag

    Hi,
    The last message was not posted by the same user_name that started the thread.
    Please don't do that: it's confusing.
    Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
    You just have to unpivot that data to get one row for every change, like this:
    WITH     single_row  AS
         SELECT     c.curr_parent
         ,     c.curr_child
         ,     c.curr_child_attribute1
         ,     c.curr_child_attribute2
         ,     c.curr_child_attribute3
         ,     DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
         ,     DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
         ,     DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
         FROM     current_tbl    c
         JOIN     previous_tbl   p     ON  c.curr_parent     = p.prev_parent
                                AND c.curr_child     = p.prev_child
         WHERE     c.curr_child_attribute1     != p.prev_child_attribute1
         OR     c.curr_child_attribute2     != p.prev_child_attribute2
         OR     c.curr_child_attribute3     != p.prev_child_attribute3
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 3
    SELECT     s.curr_parent     AS parent
    ,     s.curr_child     AS child
    ,     CASE     c.n
              WHEN  1  THEN  s.curr_child_attribute1
              WHEN  2  THEN  s.curr_child_attribute2
              WHEN  3  THEN  s.curr_child_attribute3
         END          AS attribute
    ,     c.n          AS attribute_value
    FROM     single_row     s
    JOIN     cntr          c     ON     c.n IN ( s.diff1
                                    , s.diff2
                                    , s.diff3
    ORDER BY  attribute_value
    ,            parent
    ,            child
    ;

  • Need help with a Java-SQL connection

    My classmates and I created a DesktopFrame. Within it are reports that require a connection to an MS Access Database. When a report in an InternalFrame is opened: the SQL command works, there is a connection, and everything goes well on the first run.
    However, when another InternalFrame is opened or when the same InternalFrame is opened the 2nd time, an error occurs. It produces a java.sql.SQLException: General Error.
    Can anyone help me? Thanks in advance.

    Provide more info, maybe even some code segments. (Not all). May be easier to help

  • Need help with this pl/sql block

    hi iam preparing for 1z0-001 exam..iam not able to figure out this      .plz help
    Which line in the following PL/SQL block will raise an exception?
    1 TYPE emp_typ is RECORD (
    emp_no VARCHAR2(20),
    name scott.emp.name%TYPE);
    2 emp_rec emp%ROWTYPE;
    3 BEGIN
    4 SELECT * INTO emp_rec FROM emp
    WHERE emp_no=12;
    5 emp_rec.emp_no := emp_seq.nextval;
    6 INSERT INTO emp VALUES (emp_rec);
    7 END;
    1. Line 1
    2. Line 2
    3. Line 4
    4. Line 6
    ans:D. sybex text book
    how is it possible??/
    thank u
    rajiv

    0. "DECLARE" is missing (or CREATE PROCEDURE...)
    1a. emp_typ is declared but never used. Not strictly an error but suspicious.
    1b. In the code, emp_no is a number but is declared here as a varchar2. Yuck.
    2. fine.
    3. fine.
    4. fine.
    5. You can't directly assign a sequence like this. It must be part of a sql statement.
    6. Omit the parentheses around emp_rec.

  • [Help]Need help with variables php,Sql

    I have a table users contain fiedls "old,new & total"
    when submit , update users SET total = $total
    where $total = $old+$new
    I did this , I used echo to make sure it is ok , but it is not :
    /* Variable to Count Total  */
    $old=$row_rs_users['old'];
    $new=$row_rs_users['new'];
    $total=$old+ $new;
    echo $total;
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "doit_form")) {
      $updateSQL = sprintf("UPDATE users SET total=%s WHERE id=%s",
                           $total,
                           GetSQLValueString($_POST['id'], "int"));
    Thanks,

    Seeing only part of your code, it's impossible to debug.
    However, your approach is wrong anyway. All you need to do is to add the new value to the old one in the SQL query.
    $updateSQL = sprintf("UPDATE users SET total=(total+%s) WHERE id=%s",
                           GetSQLValueString($_POST['fieldName'], "double"),
                           GetSQLValueString($_POST['id'], "int"));
    $_POST['fieldName'] is the new value being added. Use "double" if the value contains a decimal point. If it's an integer, change "double" to "int".

  • Need help with querying pl/sql collections

    hi all,
    i have a requirement wherein i look thru a number of records and then updates. then i need to check if these records were successfully updated. i have the following code but it doesn't work on the part where i query the collection.
    declare
      type ap_invoices_all_tbl is table of ap_invoices_all%rowtype;
      ap_invoices_all_rec ap_invoices_all_tbl;
      cursor cai is
        select *
          from ap_invoices_all ai
         where source = 'XXX';
    begin
      open cai;
      fetch cai bulk collect into ap_invoices_all_rec;
      for i in 1..ap_invoices_all_rec.count loop
        begin
        dbms_output.put_line('Invoice Status: ' || ap_invoices_pkg.get_approval_status( ap_invoices_all_rec(i).invoice_id, ap_invoices_all_rec(i).invoice_amount, ap_invoices_all_rec(i).payment_status_flag, ap_invoices_all_rec(i).invoice_type_lookup_code));
        exception
          when no_data_found then
            null;
        end;
      end loop;
      for j in ( select * from ap_invoices_all ai
                  where invoice_id in ( select invoice_id
                                          from ap_invoices_all_rec ))
      loop
        dbms_output.put_line('Invoice Number: ' || j.invoice_num);
      end loop;
    end;i do understand that i cannot use select statement directly on a collection but i just wanted to show what i'm trying to achieve.
    any suggestions on what i should do?
    thanks
    allen

    You can not use locally defined collection(pl/sql) in SELECT statement directly, instead use Objects defined in schema.
    For example:
    SQL> CREATE OR REPLACE TYPE emp_rec IS OBJECT (
      2                      v_sal    NUMBER(7,2),
      3                      v_name   VARCHAR2(35),
      4                      v_empno  NUMBER(4),
      5                      v_deptno NUMBER(2)
      6                      )
      7  ;
      8  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_tab IS TABLE OF emp_rec;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE dept_rec IS OBJECT (
      2                      v_deptno NUMBER,
      3                      v_dname VARCHAR2(50)
      4                      )
      5  ;
      6  /
    Type created.
    SQL> CREATE OR REPLACE TYPE dept_tab IS TABLE OF dept_rec;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_dept_rec IS
      2                     OBJECT (
      3                      v_sal     NUMBER,
      4                      v_name     VARCHAR2(35),
      5                      v_deptname VARCHAR2(30)
      6                      );
      7  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_dept_tab_type IS TABLE OF emp_dept_rec;
      2  /
    Type created.
    SQL> set serverout on
    SQL> DECLARE
      2    l_emp_dept_tab emp_dept_tab_type; --emp_dept_tab_type declared in database
      3    l_emp_tab      emp_tab; --emp_tab declared in database
      4    l_dept_tab     dept_tab; --dept_tab declared in database
      5 
      6    CURSOR e1 IS
      7      SELECT emp_rec(sal, ename, empno, deptno) FROM emp; --Note the type casting here
      8 
      9    CURSOR d1 IS
    10      SELECT dept_rec(deptno, dname) FROM dept; --Note the type casting here
    11  BEGIN
    12    OPEN e1;
    13 
    14    FETCH e1 BULK COLLECT
    15      INTO l_emp_tab;
    16 
    17    OPEN d1;
    18 
    19    FETCH d1 BULK COLLECT
    20      INTO l_dept_tab;
    21 
    22    SELECT CAST(MULTISET (SELECT em.v_sal, em.v_name, dep.v_dname
    23                   FROM TABLE(l_emp_tab) em, TABLE(l_dept_tab) dep
    24                  WHERE em.v_deptno = dep.v_deptno) AS emp_dept_tab_type)
    25      INTO l_emp_dept_tab
    26      FROM DUAL;
    27    FOR i IN 1 .. l_emp_dept_tab.COUNT LOOP
    28      dbms_output.put_line(l_emp_dept_tab(i)
    29                           .v_sal || '--' || l_emp_dept_tab(i)
    30                           .v_name || '--' || l_emp_dept_tab(i).v_deptname);
    31    END LOOP;
    32 
    33  END;
    34  /
    1300--MILLER--ACCOUNTING
    5000--KING--ACCOUNTING
    2450--CLARK--ACCOUNTING
    3000--FORD--RESEARCH
    1100--ADAMS--RESEARCH
    3000--SCOTT--RESEARCH
    2975--JONES--RESEARCH
    800--SMITH--RESEARCH
    950--JAMES--SALES
    1500--TURNER--SALES
    2850--BLAKE--SALES
    1250--MARTIN--SALES
    1250--WARD--SALES
    1600--ALLEN--SALES
    PL/SQL procedure successfully completed.
    SQL>

  • Need help with mini

    hello all you all,
    i have a mini ipod that works great, but recently my hard drive on my powerbook died and i had my hardrive replaced. i have heard that if i do link my mini to my mac, that i will lose everything on my mini- i think it was set up to automatically sync - and it has been quite some time since i have tried syncing my mini to my laptop. i have most of my music that i can put back into my laptop, but there are a few things that were special audios that i had (not music) that were also on my ipod that i don't have back-up copies of to put back onto my laptop-
    is there anything i can do to adjust the setting so it won't erase everything as soon as i link it to my laptop?"
    so, that is my dilemma -
    if anybody has a solution that would be great- for now, i have decided not to connect my mini to my laptop and just use it as is, with no more songs or audios added to the mini.
    Thanks so much for any advice that you all have for me : )
    belovedjs
    PowerMac Pro 17" and Powerbook 12"   Mac OS X (10.4.8)   ipod 5th generation, mini ipod

    Press the Option and Command keys while connecting the iPod to your computer and keep holding them down until the iPod becomes visible in the iTunes source list; this keyboard shortcut temporarily stops the automatic synchronization, and you can then change it to manual synchronization.
    (19454)

  • Need help with adding an SQL LOB target for BizTalk Services

    The goal is to create a SQL LOB to connect to an Azure SQL database. However, the connection parameters are not getting accepted, and the error, "A network-related
    or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes
    Provider, error: 40 - Could not open a connection to SQL Server)", is encountered.
    Both the SQL Azure and the database firewall rules have been set to allow the local system IP... No go...
    Could you please suggest what to provide in the connection parameters.
    Thanks and warm regards,
    Chandrasekhar G

    Thank you for your response, Fanny.
    Yes, I've been doing that already...
    Server names tried:xxxxxxxx.database.windows.net and
    xxxxxxxx.database.windows.net,1433
    Catalog: database_name
    Similarly with the username; tried user, user@servername
    and user@full-qualified-server-name.
    Also tried turning on the firewall rules at the db level...
    Enabled port 1433, too, from my local computer on the outbound, as a Microsoft link suggested.
    Even tried setting the Encrypt property to True.
    I tried telneting on port 1433 from an Azure VM and it works. But not from my local system, though there are no restrictions on this corporate network. Just ports 80 and 1433...
    I think that the Azure SQL database does not allow port 1433 for IPs, outside of the Azure network. Trying to figure out how to enable that to allow my IP on this specific 1433 port...
    Thanks and warm regards,
    Chandrasekhar G

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Phil0124 wrote:
    Apps downloaded with an Apple ID are forever tied to that Apple ID and will always require it to update.
    The only way around this is to delete the apps that require the other Apple ID and download them again with yours.
    Or simply log out of iTunes & App stores then log in with updated AppleID.

  • HT1329 hi i need help with my ipod nano i want to get my music from my ipod to i tunes so that i can be able to transfer the music on my i tunes to my ipad mini can you help me with that ?

    hi i need help with my ipod nano i want to transfer my music from the ipod to the itunes so that i can be able to transfer the music to my ipad can you help me with that ?

    You cannot use iTunes to transfer song files from iPod to computer, except for songs purchased from the iTunes Store.  However, there are third-party methods and utilities that can transfer from iPod to computer.  If you do an Internet search on something like"iPod transfer," you should get some links.  (The CNET article seems to be popular.)
    Once the song files are on your computer's drive, you can add them to your iTunes library, and then sync your iPad.

  • Need help with calculator project for an assignment...

    Hi all, I please need help with my calculator project that I have to do for an assignment.
    Here is the project's specifications that I need to do"
    """Create a console calculator applicaion that:
    * Takes one command line argument: your name and surname. When the
    program starts, display the date and time with a welcome message for the
    user.
    * Display all the available options to the user. Your calculator must include
    the arithmetic operations as well as at least five scientific operations of the
    Math class.
    -Your program must also have the ability to round a number and
    truncate it.
    -When you multiply by 2, you should not use the '*' operator to perform the
    operation.
    -Your program must also be able to reverse the sign of a number.
    * Include sufficient error checking in your program to ensure that the user
    only enters valid input. Make use of the String; Character, and other
    wrapper classes to help you.
    * Your program must be able to do conversions between decimal, octal and
    hex numbers.
    * Make use of a menu. You should give the user the option to end the
    program when entering a certain option.
    * When the program exits, display a message for the user, stating the
    current time, and calculate and display how long the user used your
    program.
    * Make use of helper classes where possible.
    * Use the SDK to run your program."""
    When the program starts, it asks the user for his/her name and surname. I got the program to ask the user again and again for his/her name and surname
    when he/she doesn't insert anything or just press 'enter', but if the user enters a number for the name and surname part, the program continues.
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??
    Here is the programs code that I've written so far:
    {code}
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class Project {
         private static String nameSurname = "";     
         private static String num1 = null;
         private static String num2 = null;
         private static String choice1 = null;
         private static double answer = 0;
         private static String more;
         public double Add() {
              answer = (Double.parseDouble(num1) + Double.parseDouble(num2));
              return answer;
         public double Subtract() {
              answer = (Double.parseDouble(num1) - Double.parseDouble(num2));
              return answer;
         public double Multiply() {
              answer = (Double.parseDouble(num1) * Double.parseDouble(num2));
              return answer;
         public double Divide() {
              answer = (Double.parseDouble(num1) / Double.parseDouble(num2));
              return answer;
         public double Modulus() {
              answer = (Double.parseDouble(num1) % Double.parseDouble(num2));
              return answer;
         public double maximumValue() {
              answer = (Math.max(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double minimumValue() {
              answer = (Math.min(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double absoluteNumber1() {
              answer = (Math.abs(Double.parseDouble(num1)));
              return answer;
         public double absoluteNumber2() {
              answer = (Math.abs(Double.parseDouble(num2)));
              return answer;
         public double Squareroot1() {
              answer = (Math.sqrt(Double.parseDouble(num1)));
              return answer;
         public double Squareroot2() {
              answer = (Math.sqrt(Double.parseDouble(num2)));
              return answer;
         public static String octalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
    String octal1 = Integer.toOctalString(iNum1);
    return octal1;
         public static String octalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String octal2 = Integer.toOctalString(iNum2);
              return octal2;
         public static String hexadecimalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
              String hex1 = Integer.toHexString(iNum1);
              return hex1;
         public static String hexadecimalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String hex2 = Integer.toHexString(iNum2);
              return hex2;
         public double Round1() {
              answer = Math.round(Double.parseDouble(num1));
              return answer;
         public double Round2() {
              answer = Math.round(Double.parseDouble(num2));
              return answer;
              SimpleDateFormat format1 = new SimpleDateFormat("EEEE, dd MMMM yyyy");
         Date now = new Date();
         SimpleDateFormat format2 = new SimpleDateFormat("hh:mm a");
         static Date timeIn = new Date();
         public static long programRuntime() {
              Date timeInD = timeIn;
              long timeOutD = System.currentTimeMillis();
              long msec = timeOutD - timeInD.getTime();
              float timeHours = msec / 1000;
                   return (long) timeHours;
         DecimalFormat decimals = new DecimalFormat("#0.00");
         public String insertNameAndSurname() throws IOException{
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        while (nameSurname == null || nameSurname.length() == 0) {
                             for (int i = 0; i < nameSurname.length(); i++) {
                             if ((nameSurname.charAt(i) > 'a') && (nameSurname.charAt(i) < 'Z')){
                                       inputCorrect = true;
                        else{
                        inputCorrect = false;
                        break;
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your name and surname: ");
                             nameSurname = inStream.readLine();
                             inputCorrect = true;
                        }catch (IOException ex) {
                             System.out.println("You did not enter your name and surname, " + nameSurname + " is not a name, please enter your name and surname :");
                             inputCorrect = false;
                        System.out.println("\nA warm welcome " + nameSurname + " ,todays date is: " + format1.format(now));
                        System.out.println("and the time is now exactly " + format2.format(timeIn) + ".");
                        return nameSurname;
              public String inputNumber1() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter a number you want to do a calculation with and hit <ENTER>: ");
                             num1 = br.readLine();
                             double number1 = Double.parseDouble(num1);
                             System.out.println("\nThe number you have entered is: " + number1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("\nYou did not enter a valid number: " + "\""+ num1 + "\" is not a number!!");
                             inputCorrect = false;
                        return num1;
         public String calculatorChoice() throws IOException {
              System.out.println("Please select an option of what you would like to do with this number from the menu below and hit <ENTER>: ");
              System.out.println("\n*********************************************");
              System.out.println("---------------------------------------------");
              System.out.println("Please select an option from the list below: ");
              System.out.println("---------------------------------------------");
              System.out.println("1 - Add");
              System.out.println("2 - Subtract");
              System.out.println("3 - Multiply");
              System.out.println("4 - Divide (remainder included)");
              System.out.println("5 - Maximum and minimum value of two numbers");
              System.out.println("6 - Squareroot");
              System.out.println("7 - Absolute value of numbers");
              System.out.println("8 - Octal and Hexadecimal equivalent of numbers");
              System.out.println("9 - Round numbers");
              System.out.println("0 - Exit program");
              System.out.println("**********************************************");
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your option and hit <ENTER>: ");
                             choice1 = inStream.readLine();
                             int c1 = Integer.parseInt(choice1);
                             System.out.println("\nYou have entered choice number: " + c1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid choice number: " + "\""+ choice1 + "\" is not in the list!!");
                             inputCorrect = false;
                        return choice1;
         public String inputNumber2() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br2 = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter another number you want to do the calculation with and hit <ENTER>: ");
                             num2 = br2.readLine();
                             double n2 = Double.parseDouble(num2);
                             System.out.println("\nThe second number you have entered is: " + n2);
                             System.out.println("\nYour numbers are: " + num1 + " and " + num2);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid number: " + "\""+ num2 + "\" is not a number!!");
                             inputCorrect = false;
                        return num2;
         public int Calculator() {
              int choice2 = (int) Double.parseDouble(choice1);
              switch (choice2) {
                        case 1 :
                             Add();
                             System.out.print("The answer of " + num1 + " + " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 2 :
                             Subtract();
                             System.out.print("The answer of " + num1 + " - " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 3 :
                             Multiply();
                             System.out.print("The answer of " + num1 + " * " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 4 :
                             Divide();
                             System.out.print("The answer of " + num1 + " / " + num2 + " is: " + decimals.format(answer));
                             Modulus();
                             System.out.print(" and the remainder is " + decimals.format(answer));
                             break;
                        case 5 :
                             maximumValue();
                             System.out.println("The maximum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             minimumValue();
                             System.out.println("The minimum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 6 :
                             Squareroot1();
                             System.out.println("The squareroot of value " + num1 + " is: " + decimals.format(answer));
                             Squareroot2();
                             System.out.println("The squareroot of value " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 7 :
                             absoluteNumber1();
                             System.out.println("The absolute number of " + num1 + " is: " + decimals.format(answer));
                             absoluteNumber2();
                             System.out.println("The absolute number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 8 :
                             octalEquivalent1();
                             System.out.println("The octal equivalent of " + num1 + " is: " + octalEquivalent1());
                             octalEquivalent2();
                             System.out.println("The octal equivalent of " + num2 + " is: " + octalEquivalent2());
                             hexadecimalEquivalent1();
                             System.out.println("\nThe hexadecimal equivalent of " + num1 + " is: " + hexadecimalEquivalent1());
                             hexadecimalEquivalent2();
                             System.out.println("The hexadecimal equivalent of " + num2 + " is: " + hexadecimalEquivalent2());
                             break;
                        case 9 :
                             Round1();
                             System.out.println("The rounded number of " + num1 + " is: " + decimals.format(answer));
                             Round2();
                             System.out.println("The rounded number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 0 :
                             if (choice2 == 0) {
                                  System.exit(1);
                             break;
                   return choice2;
              public String anotherCalculation() throws IOException {
                   boolean inputCorrect = false;
                   while (inputCorrect == false) {
                             try {                              
                                  BufferedReader br3 = new BufferedReader (new InputStreamReader(System.in));
                                  System.out.print("\nWould you like to do another calculation? Y/N ");
                                  more = br3.readLine();
                                  String s1 = "y";
                                  String s2 = "Y";
                                  if (more.equals(s1) || more.equals(s2)) {
                                       inputCorrect = true;
                                       while (inputCorrect = true){
                                            inputNumber1();
                                            System.out.println("");
                                            calculatorChoice();
                                            System.out.println("");
                                            inputNumber2();
                                            System.out.println("");
                                            Calculator();
                                            System.out.println("");
                                            anotherCalculation();
                                            System.out.println("");
                                            inputCorrect = true;
                                  } else {
                                       System.out.println("\n" + nameSurname + " thank you for using this program, you have used this program for: " + decimals.format(programRuntime()) + " seconds");
                                       System.out.println("the program will now exit, Goodbye.");
                                       System.exit(0);
                             } catch (IOException ex){
                                  System.out.println("You did not enter a valid answer: " + "\""+ more + "\" is not in the list!!");
                                  inputCorrect = false;
              return more;
         public static void main(String[] args) throws IOException {
              Project p1 = new Project();
              p1.insertNameAndSurname();
              System.out.println("");
              p1.inputNumber1();
              System.out.println("");
              p1.calculatorChoice();
              System.out.println("");
              p1.inputNumber2();
              System.out.println("");
              p1.Calculator();
                   System.out.println("");
                   p1.anotherCalculation();
                   System.out.println("");
    {code}
    *Can you please run my code for yourself and have a look at how this program is constructed*
    *and give me ANY feedback on how I can better this code(program) or if I've done anything wrong from your point of view.*
    Your help will be much appreciated.
    Thanks in advance

    Smirre wrote:
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??You cannot restrict the user. It is a sad fact in programming that the worst bug always sits in front of the Computer.
    What you could do is checking the input string for numbers. If it contains numbers, just reprompt for the Name.
    AND you might want to ask yourself why the heck a calculator needs to know the users Name.

  • I need help with a SELECT query - help!

    Hello, I need help with a select statement.
    I have a table with 2 fields as shown below
    Name | Type
    John | 1
    John | 2
    John | 3
    Paul | 1
    Paul | 2
    Paul | 3
    Mark | 1
    Mark | 2
    I need a query that returns everything where the name has type 1 or 2 but not type 3. So in the example above the qery should bring back all the "Mark" records.
    Thanks,
    Ian

    Or, if the types are sequential from 1 upwards you could simply do:-
    SQL> create table t as
      2  select 'John' as name, 1 as type from dual union
      3  select 'John',2 from dual union
      4  select 'John',3 from dual union
      5  select 'Paul',1 from dual union
      6  select 'Paul',2 from dual union
      7  select 'Paul',3 from dual union
      8  select 'Paul',4 from dual union
      9  select 'Mark',1 from dual union
    10  select 'Mark',2 from dual;
    Table created.
    SQL> select name
      2  from t
      3  group by name
      4  having count(*) <= 2;
    NAME
    Mark
    SQL>Or another alternative if they aren't sequential:
    SQL> ed
    Wrote file afiedt.buf
      1  select name from (
      2    select name, max(type) t
      3    from t
      4    group by name
      5    )
      6* where t < 3
    SQL> /
    NAME
    Mark
    SQL>Message was edited by:
    blushadow

Maybe you are looking for

  • Deleting Project Folders in X5

    Please Help. I'm using RH X5 with SVN as my source control software. I cannot delete top level project folders after I have created them. How can I delete them? Thank you.

  • BAPI_ACC_... Pb

    Hello, I've tried : BAPI_ACC_GL_POSTING_POST, BAPI_ACC_DOCUMENT_POST and BAPI_ACC_EMPLOYEE_EXP_POST, in order to post (F-02) some expenses note. In all cases, I don't really know how to fill the DOCUMENTHEADER-OBJ_TYPE : 'BBKPF' ? And I ve always the

  • Airport Network Hierarchy Changes Randomly in Utility

    I have a Time Capsule (4th Generation) and two AirPort Expresses (2nd Generation).  The TC is my primary station/router.  The two AEs are located in different parts of the house.  The TC is broadcasting a wireless signal.  It is also feeding the two

  • Displaying and Moving Characters in Maze

    Right now, i am tryin to get keyListener to work. But how do I go about creating the character that appears in the maze. And how do i make the character move according to the path and so that it does not walk through the walls? import java.awt.*; imp

  • Crazy green tint on greys in Illustrator CS5.1

    I've just downloaded the trial of CS5 having used Illustrator since before the Creative Suite existed. I'm trying to set up some colours but every time I'm making greys, they are coming out with this gnarly green tint that I don't want. The colour I'