A confusing query

Hi All,
will this query result give an info about why my profit period is different in the report between balance sheet and profit and loss:
SELECT distinct case
when
T0.transtype = 60
then 'Goods Issue'
when
T0.transtype = 59
then 'Goods Receipt'
when
T0.transtype = 69
then 'Landed Cost'
when
T0.transtype = 162
then 'Material Revaluation'
else t0.transtype
end as 'Document Type',
T0.baseref as 'Document Number', t0.transid as 'Journal Entry Number'
FROM
OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
WHERE
T0.TransType in (59, 60, 69, 162) and
T1.Account in (SELECT distinct InvntAct FROM OINM) and
T1.ContraAct in (SELECT distinct InvntAct FROM OINM)
Pls give advice. TIA
Rajh

Rajh,
The query you have has nothing to do with profit period being different in the report between balance sheet and profit and loss
It is a simple report giving you the Doc Type, Doc Number and Trans ID for transactions that match the OINM (warehouse jounrnal) table G/L.

Similar Messages

  • Purchase Order form printing error.

    Hi all experts,
    I am not sure which category I should put this question to. Please guide me if I have raised the question in the wrong category, so that I can raise it at the right category. Sorry!
    I am having some problems in printing Purchase Order form using Simple Mail, let's say I am using output type MAHN. Whenever the PO is generated in Simple Mail, a print preview screen with Output Device is pop up, and require me to key in the details like printer name in order to proceed to next step (which is not necessary for my case).
    Whereas, in normal print preview, there is no such pop up display.
    I am suspecting of it is caused of the setting. But I do not know how to solve it.
    Anyone experienced this before? Please help.
    Thanks in advance.

    Hi Sachin D C,
    I am sorry for the confusing query. Actually what I wanted to say is: -
    1) printing the PO - maintain condition records for output type NEU (working fine)
    2) printing Dunning Deliv Remind - output type MAHN (working fine in manual print out)
    3) printing Dunning Deliv Remind - output type MAHN (not working in simple mail)
    Whenever the Dunning Deliv Remind is generated in Simple Mail, a print preview screen with Output Device is pop up and following by another pop up screen Output Processing analysis.
    Do you have better understanding now?
    Please help.

  • Purchase Order form printout error.

    Hi all experts,
    I am not sure which category I should put this question to. Please guide me if I have raised the question in the wrong category, so that I can raise it at the right category. Sorry!
    I am having some problems in printing Purchase Order form using Simple Mail, let's say I am using output type MAHN. Whenever the PO is generated in Simple Mail, a print preview screen with Output Device is pop up, and require me to key in the details like printer name in order to proceed to next step (which is not necessary for my case).
    Whereas, in normal print preview, there is no such pop up display.
    I am suspecting of it is caused of the setting. But I do not know how to solve it.
    Anyone experienced this before? Please help.
    Thanks in advance.

    Hi Sachin D C,
    I am sorry for the confusing query. Actually what I wanted to say is: -
    1) printing the PO - maintain condition records for output type NEU (working fine)
    2) printing Dunning Deliv Remind - output type MAHN (working fine in manual print out)
    3) printing Dunning Deliv Remind - output type MAHN (not working in simple mail)
    Whenever the Dunning Deliv Remind is generated in Simple Mail, a print preview screen with Output Device is pop up and following by another pop up screen Output Processing analysis.
    Do you have better understanding now?
    Please help.

  • Problem to summarize parts of a sequence

    Hi together,
    I'm new here and I only have some basic know how about Oracle PL SQL.
    I'd like to create a confusing query in SQL Developer.
    I tried to split a sequence into single numbers and multiplied this numbers with different values. By then everything worked fine.
    This is the statement to split my sequence:
    SELECT
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),1,1)*3),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),2,1)*1),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),3,1)*3),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),4,1)*1),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),5,1)*3),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),6,1)*1),
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),7,1)*3)
    from dual;
    But now i tried to summarize (sum) the output of the multiplication and get an error.
    With this statement:
    SELECT sum(
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),1,1)*3)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),2,1)*1)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),3,1)*3)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),4,1)*1)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),5,1)*3)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),6,1)*1)+
    (substr(LPAD(CAST(SEQ_LOID.nextval AS number(8)), 7, '0'),7,1)*3))
    from dual;
    02287. 00000 -  "sequence number not allowed here"
    *Cause:    The specified sequence number (CURRVAL or NEXTVAL) is inappropriate
               here in the statement.
    *Action:   Remove the sequence number.
    Thank's in advance for your help. I appreciate for any kind of hints.
    I spent many hours and couldn't find a solution.

    Hi,
    There are pretty severe restrictions on where sequences can be used.  See the SQL language manual
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/pseudocolumns002.htm#sthref45
    for details.  It specifially says that you can't use NEXTVAL in a query with a GROUP BY clause.  It doesn't say anything about a query that uses an aggregate function (such as SUM) but no GROUP BY clause, like your query.  Using aggregate functions without a GROUP BY clause produces the same results as "GROUP BY NULL"  (or any constant in place of NULL), so it's easy to imagine that the restriction applies to any query with aggregate functions, whether or not it uses GROUP BY.
    What are you trying to do?  Do you really need a sequence to do it?  The analytic ROW_NUMBER function can generate unique, consecutive integers, very much like a sequence.  Could you use ROW_NUMBER fot whatever it is you need?
    Assuming you really do need a sequence, you could create a table (perhaps a Global Temporary Table), populate it with values from the sequence, and then use those values any way you want in a query.  Or you could capture one sequence value in a substitution variable, then use that variable any way you want in a query, e.g., using ROW_NUMBER to generate consecutive integers starting with theat number.
    If you cvan explain what you need to do, someone can help you find a good way to do it in Oracle.
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Payment settle

    I've settled a vendor payment. However, due to mistake, I reversed these entry by t-code FB08. then I use FBR2 to reversed the reversed document. Then the vendor payment should be settled. but the payment still to be outstanding. What should I do. thanks!

    Hi There,
    Please see the flow of what has happened:-
    On Vendor Payment Settlement = Payment Document Got Created and It Cleared the Invoice Document.
    On FB08 = The Payment Document has got Reveresed and Invoice is open again.
    On FBR2 = The Reversal Document got Reversed, resulting in a payment document but it does not clear the invoice automatically as link is broken.
    Now you need to do the below:-
    By F-44 = Clear the document created in FBR2 with the original invoice document.
    Please let me know in case you have any more confusion/ query.
    Regards,
    Gaurav

  • What happen if I change a role after I released the transport?

    Here is my Scenerio:
    1) Assuming I've created a role : ROLE1 in DEV
    2) I create a transport TR1 with that ROLE1, NOT yet released.
    3) Then I added ME21 txn to ROLE1.
    4) Then I released the transport TR1
    5) Then I remove ME21 txn from ROLE1.
    6) Then I transport role from DEV to QA.
    Q1) I would expect In QA, ROLE1 will still has ME21. - True?
    Q2) TR1 will be the snapshot of the ROLE1 when I release the transport TR1 - True?
    Now, I want to delete the ROLE1,
    A) I would need to create another Transport TR2 first with ROLE1 in DEV
    B) Then delete ROLE1 in DEV
    C) Then release Transport TR2
    D) Then I decided that I still need ROLE1. (oops)
    Q3 I should not transport TR2 so that it won't delete it in QA. - True?

    Hi Dominick,
    >
    > 1) Assuming I've created a role : ROLE1 in DEV
    >
    > 2) I create a transport TR1 with that ROLE1, NOT yet released.
    >
    > 3) Then I added ME21 txn to ROLE1.
    You should add the role again to the Transport to avoid inconsistency
    > 4) Then I released the transport TR1
    >
    > 5) Then I remove ME21 txn from ROLE1.
    >
    > 6) Then I transport role from DEV to QA.
    > -
    >
    > Q1) I would expect In QA, ROLE1 will still has ME21. - True?
    Answer: If you reassign the role to the TR then you will get.
    > Q2) TR1 will be the snapshot of the ROLE1 when I release the transport TR1 - True?
    Answer:  TRUE (but without ME21 if you don't add the change to the CR - see below for detail discussion)
    > -
    >
    >
    > Now, I want to delete the ROLE1,

    > A) I would need to create another Transport TR2 first with ROLE1 in DEV
    >
    > B) Then delete ROLE1 in DEV
    >
    > C) Then release Transport TR2
    >
    > D) Then I decided that I still need ROLE1. (oops)
    > -
    > Q3 I should not transport TR2 so that it won't delete it in QA. - True?
    Answer:  TRUE. And if you want the role again back to DEV without recreating it, please download the role from QAS or PROD and then Upload it to DEV. After that you need to generate the Profile of the role.
    > -
    FYI:   When a Change is Included into a request to send in other systems, then this request is called "Change Request" (CR). After Releasing, the CR called as "Transport request".
    CRs are basically (in layman language) the Pointers to the DB changes performed. These are included into a CR as "Task". A CR can contain multiple Tasks created by different users.
    Please note if this is a Workbench CR then it is ONLY editable by that particular user(owner of the Task). Also the Object captured in a Task of a WCR possesses a Lock till it gets released and thus can't be added to any other Task of a different CR. The Objects are unlocked when the Tasks and the CR is released respectively.
    There are no Object Lock for Customizing CRs ... like your TR1 which contains Creation / Deletion of roles.
    After the release of each Task, all Objects contained into every Task are transferred to the Change Request. After release of all Tasks, the CR owner can release the CR and thus the Transport Request has been initiated. Technically, at this time, a copy of Data from the Database of DEV captured under the headers of each Tasks are written to Data Files in Central Transport Directory.
    Now coming to your queries..... there are no such synchronization happens for a Task if the Objects are edited in different time frames before Release.  So, when you added ME21, again you need to assign this change to the same CR. (_Answer to your Q1_)
    Please let me know if you have any confusion / query.
    Regards,
    Dipanjan

  • Internet connection problem after migrating from Powerbook G4

    After starting up my friend's new Macbook 2ghz for the first time, I migrated everything from his old Powerbook G4. However on starting the machine for the first time, although the Internet Status suggested his Airport connection to his Netgear router was working and that he was connected to the Internet, this was not the case, as the registration info could not be sent to Apple, the time/date wouldn't update and he could not browse or check e-mail.
    Initially it occurred to me that perhaps the Netgear router didn't like the fact that the same Network settings (IP address) had been given to the Macbook when it had a different MAC address. However this didn't seem to be the case as I was able to add the new Macbook to the list of trusted devices and turn on Access Control, but this still didn't work
    Eventually when I turned off the security settings, so that the password was set to "none", instead of WPA/PSK and then did likewise for the named network on the computer, I was able to get online at long last
    However I don't want to leave the wi-fi system without any password protection for obvious reasons. His Netgear router is a newer model than mine and it had a choice of WPA2, and when I tried this and did likewise on the Macbook it was still working. Yet the matter gets more complicated as he also has a PC on the same wi-fi network and this would not accept the WPA2 setting on the router and I could not get online with the PC
    I dont understand why WPA2 worked on the Macbook but WPA didn't and I need to find a password setting that works for both computers. I don't really understand the WEP option as the encryption choices are 64 and 128 but there's no 64 on the Macbook. More importantly I don't have the foggiest how to get a desired password, as when you put in a "passphrase' and click "generate" the router produces four different keys which are all decidedly impossible to remember and so totally impractical if you need to use these to log on.
    I appreciate that this is a bit of a confusing query but if anyone can offer any assistance., I would be extremely grateful, as after all the time it took me today to suss out actually getting his new Macbook online, I am loathe to mess around without really knowing what I am doing and so I need to find a security option that can be used by the Macbook, his older Powerbook and a PC running Windows XP
    With my utmost thanks in advance for any help you can offer, but please bear in mind I'm a bit of a techno-nincompoop so please be gentle with me
    Many thanks
    Bernard

    Thanks a million for bothering to reply, it's very much appreciated. I rarely seem to get much success when I try searching in Apple support but I guess that must be because I choose the wrong search terms.
    Since all the equipment is relatively new and quite high spec, I believe I should be able to use the WPA format and it's a matter of finding an arrangement that works with both the PC and the Macs. What I don't understand is why the Macbook appeared to be connected to the internet with a WPA password, but wouldn't in fact get online, until I either changed to no password, or to WPA2?
    However I'm extremely grateful to you because those docs all proved well worth reading, if only so I might understand some of the technical gobbledigook (the avoidance of which was one of the principal reasons I became a Mac evangelist in the first place), as the whole password encryption thing has always been a complete mystery to me, hence for my own wi-fi set-up, I long ago settled for hiding the network and turning on the trusted devices access control, just to avoid having to deal with any of this technobabble. However my mate wants people to be able to log on to his network if they turn up with a laptop, but at the same time prevent totally open access to his internet connection to all and sundry, so this is not an option.
    What really bugs me is that the interface for the Netgear modem/router (and any other router I've had experience with) never seems to work properly on an Apple, no matter what browser I use and having sold his family on the whole Apple experience, it's usually a bit embarrassing to have to squeeze my mercifully narrow backside into a baby's chair in order to use their PC to resolve any router issues (as the PC is only there for the kids to play games). But invariably it's only by using the browser interface on the PC that all the various options seem to work
    Again much appreciate you going to the bother and the fact that there is relevant stuff in the support library leads me to believe I should attempt to find some more details which might resolve the WPA difficulties I've experienced with the new Macbook.
    Meanwhile, although I am not so keen on the new glossy screen on the Macbook (I'm amazed you can't have the option of a matt one unless you get a bigger Macbook Pro), you've no idea how envious I am having to set up his new toy when I can't afford one myself. Mind you, the last time I told this bloke that if he wanted decent support for his iPod, he'd have to buy me one, he returned from the US with a 60gb model to match his (sadly pre-video iPods), so perhaps I should make matters more complicated by installing Boot Camp and Windows, so that I have to tell him that I can't offer support over the phone without one of my own
    Kind Regards
    Bernard
    Macbook 13" 2ghz"   Mac OS X (10.4.5)  
    Powerbook G4 1.67mhz 15"   Mac OS X (10.4.5)  
    Powerbook G4 1.67mhz 15"   Mac OS X (10.4.5)  
    Powerbook G4 1.67mhz 15"   Mac OS X (10.4.5)  

  • Report and ready for input Query, with similar shadings are confusing

    Some customers mix report and planning queries in their templates.
    usually the shades for PLAN Queries are
    o white - ready vor input
    o blue- display data (e.g. LY, calc KPI)
    In a Query with NO INPUT ready Cells the query has a zebra shading, blue and white, row by row.
    That is confusion for users if they believe every Number on a white background can be changed.
    Is it possible to change the shading for reporting queries to blue only?
    Best Regards,
    Georg

    Hi.
    You can cancel zebra by setting off for ALTERNATE_STYLES in properties if analysis item in WAD, BUT it sets all cells as WHITE and not blue.
    I dont know how it will be usefull, but you may try ...
    Regards.

  • Confusion in Select query having a inner join on single table

    Hi,
    I was going through coding and came a accross a select query which has a inner join on a single table. I am getting confused while analysing this . Please someone can help me analysing this query.
    select
            m~MATERIAL
            s~NUMERATOR s~DENOMINTR
            m~GROSS_WT  m~UNIT_OF_WT
          into table itab
          from ( table1as s
           inner join table1 as m
           on  m~MATERIAL = s~MATERIAL
          and m~MAT_UNIT = 'CS'
          and m~SOURSYSTEM = s~SOURSYSTEM )
          where s~MAT_UNIT = 'EA'
             and s~SOURSYSTEM = 'LD'
             and s~OBJVERS = 'A'
             and s~MATERIAL IN ( Select mat_sales
                from Table2  group by mat_sales ).
    Thank you
    Kusuma

    I don't see any use of the INNER JOIN here.
    But what's the meaning of the last selection clause?
    s~MATERIAL IN ( Select mat_sales
                from Table2  group by mat_sales ).
    Is that native SQL or something?
    Pushpraj

  • InfoSet query results confusion...

    HI All,
    We have 2 ODS.  One is Billing and the other is Project Sales.  In the billing ODS we have billing documents that have the billing date (calmonth) and employee.  The projected sales is an ODS that has for each employee for each month, their Projected Sales.
    We have created an InfoSet and linked in the billing ODS the calmonth (in billing) to period field (in Projected Sales) and 0SALESEMPLOYEE (in billing) to PERNR (in Projected) ODS.
    The Projected Sales ODS has exactly 1 entry for each employee for each month.  i.e. employee '12345' for 200501 a projected sales of 10,000.  With the above mapping the query results for projected sales is about 50X more.  In other words, it shows 30 million when it should be 150,000.  I think this has to do with it somehow including results from the billing ODS??
    We've read help about interpreting infoset query results and it's quite confusing.  It speaks of some filter option to exclude query result set, but can't figure it out.
    In addition to the monthly projected sales we want to see for each employee, we want to include all the net sales they had for the same month.  So you can see the mapping we did above.
    Query would look like this:
    Calmonth  Employee  NetSales  ProjSales
    200501    123456    220,000   10,000
    The projected sales is entirely off by millions of dollars and also the net value isn't calculating correctly.  I'm sure out setup is incorrect.
    Can someone help us out please.
    Thanks
    Mike

    Hi Ashish,
    What you explained is exactly what is the case.
    The billing ODS has many, many entries for the for the employee + calmonth combination while the projected sales only has 1.  I've figured out that this is what is happening...multiplying the number of entries in the billing X the Projected Sales.
    Is there a way to avoid this with a particular join in InfoSet? 
    The key for billing ODS has billing number, billing item and fiscal year variant, while the key for projected sales is start period and pernr.  So I don't see how a multiprovider would work because the fields are different...am I incorrect?
    Thanks for your quick reply,
    Mike

  • Confusion over Native Query Result List

    I have this confusion over the field object of a resultList of a Native query. This is because it has contradicted the idea of the books for me.
    This is a pure example
    @SqlResultSetMapping(name="LoanCapitalization.reportMapping",
    columns={
        @ColumnResult(name="policy_number"),
        @ColumnResult(name="policy_holder"),
        @ColumnResult(name="amount"),
        @ColumnResult(name="outstanding_loan"),
        @ColumnResult(name="interest"),
        @ColumnResult(name="amount_to_date"),
        @ColumnResult(name="effective_date"),
        @ColumnResult(name="sub_system_code")
    @NamedNativeQuery(name="LoanCapitalization.aggregateStatement", query="SELECT   l.policy_number, l.last_name || ' ' || l.first_name as " +
            "policy_holder, l.amount, c.out_principal_bf as outstanding_loan, c.out_interest_bf as interest, " +
            "SUM (r.repayment_amount) as amount_to_date, c.effective_date, l.sub_system_code FROM loan l JOIN v_latest_capitalization c " +
            "ON l.loan_id = c.loan_id JOIN loan_repayment r ON l.loan_id = r.loan_id WHERE " +
            "c.effective_date BETWEEN ?1 AND ?2 GROUP BY l.policy_number, l.last_name, l.first_name, l.amount, " +
            "c.out_principal_bf, c.out_interest_bf, c.effective_date, l.sub_system_code order by l.sub_system_code, l.last_name",
            resultSetMapping="LoanCapitalization.reportMapping")and
    Query query = entityManager.createNamedQuery("LoanCapitalization.aggregateStatement");
            AggregateStatementLoanBalanceReportData data = null;
            List<AggregateStatementLoanBalanceReportData> returnList = new ArrayList<AggregateStatementLoanBalanceReportData>();
            query.setParameter(1, reportCriteria.getFromDate());
            query.setParameter(2, reportCriteria.getToDate());
            List<Object[]> resultList = query.getResultList();
            System.out.println("resultList.size() >>>>>>>>>> " + resultList.size());
            for (Object[] obj : resultList){
                data = new AggregateStatementLoanBalanceReportData();
                System.out.println("(String)obj[1] >>>>>>>>>> " + (String)obj[1]);
                System.out.println("(String)obj[2] >>>>>>>>>> " + (String)obj[2]);
                System.out.println("(String)obj[3] >>>>>>>>>> " + (String)obj[3]);
                System.out.println("(String)obj[4] >>>>>>>>>> " + (String)obj[4]);
                System.out.println("(String)obj[5] >>>>>>>>>> " + (String)obj[5]);
                System.out.println("(String)obj[6] >>>>>>>>>> " + (String)obj[6]);
                data.setPolicyNumber((String)obj[0]);
                data.setName((String)obj[1]);
    .......My first shocking surpise is that all the System.out.println() return nulls but
    System.out.println("resultList.size() >>>>>>>>>> " + resultList.size()); returned 1.
    so can anyone suggest what the problem may be.
    Regards,
    Michael

    I came across your post as I experienced the same problem. As I found no answers I tried different let's say stupid solutions.
    The one that solved my problem was to write the name for the @ColumnResult in capitals as I noticed that Oracle transforms the alias column names into capitals. I guess otherwise the mapping doesn't occur correctly.
    My example:
    @SqlResultSetMappings({
    @SqlResultSetMapping(
    name = "Customers.searchCustomers",
    entities =
    @EntityResult(entityClass = Customers.class)
    columns =
    @ColumnResult(name = "CONTACTDATE"),
    @ColumnResult(name = "CONTRACTDATE")
    String queryString =
    "SELECT c.CUSTOMER_ID, c.LAST_NAME, c.FIRST_NAME, c.OPU, c.CUSTOMER_CORE_ID, " +
    "to_char(con.CONTACT_DATE, 'yyyy-dd-mm') AS CONTACTDATE, to_char(contr.CONTRACT_DATE, 'yyyy-dd-mm') AS CONTRACTDATE " +
    "FROM CUSTOMERS c " +
    "LEFT JOIN CONTACTS con ON con.CUSTOMER_ID = c.CUSTOMER_ID AND con.ACTIVE = '1' " +
    "LEFT JOIN CONTRACTS contr ON contr.CUSTOMER_ID = c.CUSTOMER_ID AND contr.ACTIVE = '1' " +
    "WHERE c.CAMPAIGN_ID = ?1 AND upper(c.LAST_NAME) LIKE ?2 AND upper(c.FIRST_NAME) LIKE ?3";
    query = em.createNativeQuery(queryString,
    "Customers.searchCustomers");

  • Confusion abt update query

    Hi,
    I want to update a field co1 in this table tbl1 using just SQL statement w/o using a cursor but i am confused
    basically the construct is like this :
    update tbl1
    set co1 = (select col2 from tbl2 a , tbl1 b  where a.mydate >= sysdate - 1
    and a.id = b.id )how can i put in the condition outside the select statement as i need only those records from tbl1 that has the same id as in tbl2 ??
    does the above statement means ALL co1 of tbl1 will be updated with the value from the select statement ??
    basically in MS MSQL i would have put it something as
    update tbl1 a  , tbl2 b
    set a.co1 = b.col2
    where a.mydate >= sysdate - 1
    and a.id = b.idkindly advise

    Hi,
    from this query that you have written
    update tbl1
    set co1 = (select tbl2.col2 from tbl2 a where
    a.mydate >= sysdate-1 and tbl1.id = a.id)
    where exists (select tbl2.col2 from tbl2 a where
    a.mydate >= sysdate-1 and tbl1.id = a.id)yes my sub query does return > 1 rows this is because
    i shld actually return tbl2.col2 , tbl2.id , tbl2.col3 in order for it to be unique
    becoz col2 can have the same/different values for each id
    and i also needs to update tbl's col3 as well
    ques :
    if i select a distinct will it actually knows that my distinct is actually based on these conditions : or based on the final results set
    select tbl2.col2 from tbl2 a where
    a.mydate >= sysdate-1 and tbl1.id = a.ide.g my values are as follows for tbl2
    col2 , id  , col3
    1 , abc , 11
    2 , adb , 22
    3 , aaa , 33tks & rdgs

  • Confusing result between 'to_date' and 'long to date' in oracle query

    I have a table called "subscription" as below.
    desc subscription;
    Name Null Type
    SUBSCRIPTION_ID NOT NULL NUMBER(38)
    EXPIRATIONDATE DATE
    And output of a query as below.
    select subscription_id,expirationdate from subscription where subscription_id = 41919;
    SUBSCRIPTION_ID EXPIRATIONDATE
    41919 18-JAN-14 13:45:56
    And I am trying to execute following query in different ways.
    1st Query:
    select s.subscription_id from subscription$active s where s.expirationdate - (116/24) between TO_DATE('13-JAN-14 11:38:22', 'dd/mm/yyyy hh24:mi:ss') and TO_DATE('13-JAN-14 18:30:00', 'dd/mm/yyyy hh24:mi:ss') and s.subscription_id=41919
    Output:
    SUBSCRIPTION_ID
    41919
    2nd Query:
    select s.subscription_id from subscription$active s where s.expirationdate - (116/24) between (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') and (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') and s.subscription_id=41919
    Output:
    SUBSCRIPTION_ID
    Here both the above where clause are same. 1st one is trying to use "to_date" and 2nd one converts "long to date". But when I see the out put, the first one returns a row and 2nd doesnot return any result. I couldn't find out what is difference the 'long to date' conversion makes here.
    The conversion between long to date is also correct.
    select (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') from dual
    Output:
    (TRUNC(1389613102220/(1000),0)/(24*60*60))+TO_DATE('01/01/1970','MM/DD/YYYY') -------------------------
    13-JAN-14 11:38:22
    And
    select (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy') from dual
    Output:
    (TRUNC(1389637800000/(1000),0)/(24*60*60))+TO_DATE('01/01/1970','MM/DD/YYYY') -------------------------
    13-JAN-14 18:30:00
    Can someone help me to understand the difference between the 1st and 2nd query ?

    Hi,
    Not sure what exactly you asking for. What is the requirement?
    Just formatted for better readability:
    -->-- Query 1
    SELECT
      s.subscription_id
    FROM subscription$active s
    WHERE
      s.expirationdate - (116/24) BETWEEN
           to_date('13-JAN-14 11:38:22', 'dd/mm/yyyy hh24:mi:ss')
           AND
           to_date('13-JAN-14 18:30:00', 'dd/mm/yyyy hh24:mi:ss')
      AND s.subscription_id=41919;
    -->-- Query 2
    SELECT
      s.subscription_id
    FROM subscription$active s
    WHERE
      s.expirationdate - (116/24) BETWEEN
           (trunc(1389613102220 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy')
           AND
           (trunc(1389637800000 / (1000), 0) / (24 * 60 * 60)) + to_date('01/01/1970','mm/dd/yyyy')
      AND s.subscription_id=41919;

  • Query filter on  a value with dash confuses for a range

    Hello, I've a web query, have a variable on a legacy PO which is char 10, the legacy PO values have legitimate - in their value for ex: 65011-001
    when i enter this value in the query filter (variable value), the query comes with msg ' this characteristic info object doest not support interval selections', and ignores the filter and bring the all the values.
    I tried putting PO enclosed with single and double quotes  but that didnt seem to work either, how can we make the variable take the literal value and do not interpret it as a range or interval.
    thanks for the help.
    Mayil

    Alright figure it out..
    looks like i've to give a escape in this case '\'
    so if i entered the value like 64917\-001 it is able to filter out in the web.
    i wonder if there is a way i cannot do this and get by..
    thanks
    Mayil

  • Join Query - Confusing behaviour

    Hi.. I need to perform a join on four tables and select data from one of the tables. The query is as below,
    SELECT VM.SEGMENT,VM.CA,VM.PR,VM.BP,VM.TERM_ID,VM.TL FROM v_mlr_cable VM , v_neicode NEI, v_mlr MLR, v_fibre_ntwk_type FIBRE WHERE MLR.master_key =62 AND MLR.dslam_tid = NEI.id AND NEI.type = 'OLT' AND MLR.ntwk_type = FIBRE.id AND MLR.master_key = VM.master_key;
    This query runs fine. I am attempting to change the query to have an OR condition by grouping certain conditions in the WHERE clause as below,
    SELECT VM.SEGMENT,VM.CA,VM.PR,VM.BP,VM.TERM_ID,VM.TL FROM v_mlr_cable VM , v_neicode NEI, v_mlr MLR, v_fibre_ntwk_type FIBRE WHERE MLR.master_key =62 AND ((MLR.dslam_tid = NEI.id AND NEI.type = 'OLT') OR MLR.ntwk_type = FIBRE.id) AND MLR.master_key = VM.master_key;
    This results in multiple duplicates of the the correct result rows (about 93,272 rows).
    I am suspecting this is performing an undesired cartesian product.
    I am restricted to use a 'distinct' since my application does customized query parsing, so 'distinct' is out of the option.
    I have trouble understanding this query result. Please help out..! Thanks in advance.
    My data base: Oracle Enterprise Edition 10.2.0.2.0
    Edited by: sugantha on Jun 9, 2011 12:49 AM

    Hi,
    sugantha wrote:
    Thanks Frank for the suggestions. The query example saved my day.
    The one-liner by LPS was a wake up call for me.. still when I tried to change the query in the below way it seemed to fail. Observe that for the four tables in the join, there are three conditions.What LPS said was soemwhat simplified. Normally, when you have N tables, you need at least N-1 join conditions. If you have fewer join conditions, then you will be doing a Cross Join . Cross joins are rare, but they are not necessarily wrong.
    If you are using the old join notation (as you are; this is where join conditions are in the WHERE clause), and the WHERE clause includes conditions linked by OR, then you might be short-circuiting some of those join conditions, and the results in those cases will be the same as a cross join. Again, this is not necessarily wrong.
    Your problem is with not a cross join per se , but rather with having unwanted duplicates. A cross join is just one way that you might be producing these duplicates. If your data has one-to-many relationships, then you will get duplicates even without a cross join.
    If all the data in the SELECT clause is coming from one table, then you don't have to do a join in the main query; you can use only that one table in the main FROM caluse, and reference the other tables in EXISTS or IN sub-querres. That way, the only way you can possible get duplicates in the output is if you actually have duplicates in the table. It won't matter if there are duplicates in the sub-queries.
    Even if you do have duplicates in the table, GROUP BY will return distinct output rows.
    SELECT SEGMENT,CA,PR,BP,TERM_ID,TL FROM V_MLR_CABLE VM , v_neicode NEI,
    v_mlr mlr WHERE mlr.master_key = 62 AND ((mlr.dslam_tid = NEI.id AND
    nei.TYPE = 'OLT') OR mlr.NTWK_TYPE IN (SELECT ID FROM
    V_FIBRE_NTWK_TYPE)) AND mlr.master_key = vm.master_key ; I see you're using \ tags; they're very useful for posting formatted text on this site, because they preserve the extra white-space you use in formatting.  As you can see, they don't automatically format the code for you; you still have to add newlines, tabs and spaces so that people who want to help you can read and understand your code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Memory upgrade on Satellite T230-113

    Good afternoon. is Toshiba T230-113 2GB of memory installed marking: Hynix 2Gb 2Rx8 PC3-8500S-7-10-F2 HMT125S6TFR8C-G7 NO AA-c I want to upgrade to 4 GB, it is better to choose? 2x2Gb or 1x4Gb? Will the two-channel mode? Thank you

  • ASA 5505 Site-to-Site VPN to remote dmz access

    I don't have a ton of experience with ASA firewalls, but I've searched everywhere and I can't seem to find a solution to this. I have 2 sites connected by a Site-to-Site VPN with ASAs (5540 on Site 1, 5505 on Site 2). I'm using ASDM. Lets call: Site

  • How do i keep my paragraph style list from growing without my permission?

    Im trying to keep my Paragraph styles organized. Everytime I add a table into my pages document it adds a new header or body eventhough all the fonts in the table are already set up with the paragraph styles that are in the document. Also it wont let

  • Problems with image gallery, Help !

    Hi, i need this gallery to be seperated from the thumbnails it interact. I need the button to open the Xmlgallery1 instead of the Xmlgallery. In other words, i want to load a different image than the thumbnails shows. Ive already copied the xml galle

  • How to get data from XML file having korea Text

    I have a one XML File with Korean Text, How to read this File. i tried with this code BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream("C:/test1.xml"), "EUC-KR")); String str = in.readLine(); but it is giving exceptio