Need SQL to get data

Hi All,
There is a table TASK with columns TASK_NAME,IS_TASK. IS_TASK column has only two distinct values 0(means PHASE) and 1(means TASK). The hierarchy is a PHASE can have one or more TASKS, but the name of PHASE and TASK is in TASK_NAME column and separated only by IS_TASK columns value. The result set I need is PHASE_NAME,TASK_NAME separately.
Please help me.
Thanks & Regards

Please consider the following when you post a question.
1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
You can use the following query and do a copy past of the output.
select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
that are asked the answer is already there.
3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
I have the following table called sales
with sales
as
      select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
      union all
      select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
select *
  from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
For example in the above sales table, I want to know the total quantity and number of invoice for each product.
The output should look like this
Prod_id   sum_qty   count_inv
1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
use the {noformat}{noformat} tags.
The usage of the tag is like this.
<place your code here>\
7. If you are posting a *Performance Related Question*. Please read
   {thread:id=501834} and {thread:id=863295}.
   Following those guide will be very helpful.
8. Please keep in mind that this is a public forum. Here No question is URGENT.
   So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need Sql for terda data database

    Can any one help send me the sql for teradata database. for creating the variables. I need to create variables for Last month begin date and last month end date.

    I am trying this tera data Sql this is for curent month date.
    select cast(current_date as date) - (extract (day from cast(current_date as date)) - 1) + interval '1' month - 1
    I need tera data sql for Last month begin date and last month end date. I searched various forums but could not get the answer. Any suggesstions please.

  • Need suggestion to get data from change log table of ODS.

    Hello,
    There is a case where i am loading opportunity header data from header ODS and opportunity item data from item ODS in the opportunity cube.
    Status (1= OPEN, 2= WON ETC) of the opportunity are available only in header ODS and not in item ODS.
    While loading data from header ODS to cube, I am loading it directly but while loading data from item ODS to cube i am using active data table of header ODS as a lookup in the update rule from item ODS to cube. I am selecting status from the active data table of header ODS while loading data from item ODS to cube.
    Since active data table will have only after image records, there is some data mismatch in the report as i am selecting data from active data table of header ODS while loading data from item ODS to cube.
    I need to select data from Change log in order to get before image also instead of active data table in order to overcome this issue. Is there any way by which i can do selection from Change log instead of active data table as change logs are generated at run time.
    Please let me know if you have any suggestions.
    Regards,
    Sanjay Chaurasia.

    Hi,
    You can use the changelog table of the DSO.
    Right click manage the Header DSO, go to the contents tab and click Change Log table. There you can see the technical name of the Change Log table.
    In the update rule Routine, give the tech name of Change log table instead of Active table name.
    Hope it helps.
    Krishna

  • Use a SQL SERVER get date in query

    I want to constrain my returned data by a change date to just return the last rolling 30 days of data. When I use sysdate, I find the plan is to retreive ALL data across the dblink, and then filter it on the Oracle side.
    Is there any way I can use the Sql Server getdate() function, something like
    select * from remote@ss_link
    where upd_date >= getdate() - 30
    Problem - how do I get Oracle to pass the Sql Server specific function call to Sql Server? [BTW I'm on an old version of Oracle...]

    It depends on the product you are using.
    If you are using a gateway you can call remote functions using the getdate@<db link> syntax as described in the Heterogeneous Admin Guide.
    For gateways and generic connectivity you can also use PASSTHROUGH which allows you to pass a statement as it is to the remote database.
    Or at least you can create a view at the SQL Server side which returns the last 30 days and then just select from this view.

  • Need advice for getting data service while traveling abroad

    I will be traveling in Norway and England and want to be able to use GPS on my Galaxy S4.  I can get along without voice service, and can rely on wi-fi for email and internet access.  I will be traveling for about 3 weeks.  Any suggestions?

    All the advise you need is right here Spokaneman! We want you to enjoy your trip to Norway and England. Yes, you can use your phone for data while traveling. Here is a link to our Global trip planner to get all the information about cost and what is needed to use your phone http://vz.to/1aGvDAs . You can add our bundle plan for 100mb for $25.00 per month or voice/data bundle for 100minutes/100sent messages and 100mb for $40.00 per month . You can also pay as you go with is $0.02 cent per KB and $20.48 per mb. Voice calls and text are extra if you're interested in those features.
    KinquanaH_VZW
    Follow us on Twitter @VZWSupport
    If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • SSIS Package : Needs SQL Tables get refreshed every hour

    Hello,
    I have created a SSIS Package which includes,
    Step 1 : Using Execute SQL Task to truncate all the tables
    Step 2 : Data Flow Tasks to extract data from SharePoint lists and fill the SQL Tables for SSRS Reporting from that.
    Requirement is to refresh SQL Tables every hour. I can do this using SQL Server Agent Job to run SSIS Package.
    But, I am not sure is this the feasible way of do this, as we are truncating all the tables. There are around 10-15 tables. Database size is also not large.
    Is there any in SSIS to impose only changes done in the SharePoint list to SQL tables rather than truncating them and creating new ones?
    Thank you,
    Mittal.

    @Visakh,
    Yes I am getting Created,CreatedBy, Modified, ModifiedBy audit fields data from all the SharePoint List.
    So, can we just trust these fields and update tables accordingly ?
    And how can I do this using SSIS ? Is there any particular control I can use to compare the data and time and update the SQL Tables?
    Thank you,
    Mittal.
    Yes. Provided they have proper data thiat should work fine.
    Yes you can use it inside SSIS
    You can have a logic like below
    1. In execute sql task capture max date for the source table
    2. Use data flow task with source query having filter based on date field
    ie like
    WHERE Modified > ?
    And map parameter to maxdate
    3. add destination step to populate data
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Need suggestion in getting data using JDBC

    Hi all need suggestion,
         i had a VO corresponding to database table.
         when i am try to get the records from that table,
         how can i initialize the particular column value to the
         corresponding VO setter method.
         please do the needful.

    Hello inform2csr,
    Your question is not so clear.
    Can you be more precise?
    What is VO?

  • Need sql to get count of workbooks written on top of seeded noetix views

    Hello, we have Apps mode end user layer which is created by NOETIX since we purchased NOETIX views and EUL. We are trying to figure out how many of our workbooks are written on top of seeded Noetix views (Folders in business areas of Noetix generated EUL) and how many of them on custom views.
    I have a sql that will give me the names of the workbooks written on a given folder. However, I am looking for a sql which can give the count of workbooks developed on all Noetix folders. Can anyone help?
    Thanks,
    Anjan Avula.

    Hi,
    According to your description, you want to get the total count of items in current list view.
    There is an OTTB feature  “Totals” in the list view settings, it can count the items existing in the current list view.
    I suggest you do as the followings:
    1. Set the total count for the column in the list view->”Totals”.
    Then, the total item count will show in the list.
    Best regards

  • Need SQL for below scenerio .

    Hi Experts,
    Consider an Order Table with the following table structure with some Sample Data:
    ORDER_DAY
    ORDER_ID
    PRODUCT_ID
    QUANTITY
    PRICE
    01-JUL-11
    O1
    P1
    5
    5
    01-JUL-11
    O2
    P2
    2
    10
    01-JUL-11
    O3
    P3
    10
    25
    01-JUL-11
    O4
    P1
    20
    5
    02-JUL-11
    O5
    P3
    5
    25
    02-JUL-11
    O6
    P4
    6
    20
    02-JUL-11
    O7
    P1
    2
    5
    02-JUL-11
    O8
    P5
    1
    50
    02-JUL-11
    O9
    P6
    2
    50
    02-JUL-11
    O10
    P2
    4
    10
    Need  SQL to get all products that got sold both the days and the number of times the product is sold.
    Desired output :
    PRODUCT_ID
    COUNT
    P1
    3
    P2
    2
    P3
    2
    Thanks and Regards,
    Sumanth Kulkarni

    Hi,
    SumanthKulkarni wrote:
    Hi
    I tried below approach , but i didnt get desired output for P1
    select count(s) a,product_id  from
    (select count(product_id) s,order_day ,product_id from orders group by order_day,product_id
    order by product_id asc) t
    group by product_id
    having count(s) >1
    Thanks and Regards
    Sumanth Kulkarni
    Run the sub-query by itself, and look at the results.  You should see something like this:
             S ORDER_DAY   PRODUCT_ID
             2 01-JUN-2011 P1
             1 02-JUN-2011 P1
             1 01-JUN-2011 P2
    When you're computing the column a for the final output, do you want to count how many rows of this result set have product_id='P1'?  That's what COUNT does, but I don't think that's what you want.
    Do you want to add up the numbers in the S column?  Then use SUM (s), not COUNT (s).
    You could also do the whole job without a sub-query, like this:
    SELECT    COUNT (*)    AS a
    ,         product_id
    FROM      orders
    GROUP BY  product_id
    HAVING    COUNT (DISTINCT order_day)  > 1

  • JSON - get data from Oracle table

    Hi all,
    I hope it is correct thread...
    My need is to get data from oracle table using JSON and show output at html table. I'm very new to JSON (got some experience in PL/SQL and basic html knowledge). Could someone direct me to manual or give me simple example?

    JSON is a way to format data, not a way to fetch data. Call it an alternative to XML.
    Are you perhaps talking about doing an ajax request to fetch data?

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • Help needed with variable - trying to get data from Oracle using linked svr

    Sorry if I posted this in the wrong forum - I just didn't know where to post it.
    I'm trying to write a simple stored procedure to get data from an oracle database via a linked server in SQL Enterprise manager. I have no idea how to pass a variable to oracle.
    Here's how I would get the variable in SQL:
    declare @maxkey INTEGER
    select @maxkey= MAX(keyfield) from [server].Data_Warehouse.dbo.mytable
    select * from [server].Data_Warehouse.dbo.mydetailtable where keyfield=@maxkey
    the select statement I need to do in oracle would use that variable like this:
    select * from OPENQUERY(OracleLinkedServer,'select
    * from ORACLEDB.TABLE where keyfield > @maxkey')
    and I get this message: OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer" returned message "ORA-00936: missing expression".
    I realize that I can't pass the @maxkey variable to oracle - so how do I accomplish this?

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • How to get data from Oracle using Native SQL in SAP.. Problem with date

    Hi Masters.
    I'm trying to get data from an Oracle DB. I was able to connect to Oracle using tcode DBCO. The connetion works fine
    I wrote this code and it works fine without the statement of where date > '01-09-2010'
    But i need that statement on the select. I read a lot about this issue, but no answer.
    My code is (this code is in SAP ECC 6.0)
    DATA: BEGIN OF datos OCCURS 0,
          id_numeric(10),
          component_name(40),
          comuna(10),
          record_id(10),
          status,
          sampled_date(10),
          END OF datos.
    DATA: c TYPE cursor.
    EXEC SQL.
      connect to 'LIM' as 'MYDB'
    ENDEXEC.
    EXEC SQL.
      SET CONNECTION 'MYDB'
    ENDEXEC.
    EXEC SQL PERFORMING loop_output.
      SELECT ID_NUMERIC, COMPONENT_NAME, COMUNA, RECORD_ID, STATUS, SAMPLED_DATE
      into :datos from lims.SAMP_TEST_RESULT
      where     date > '01-09-2010'
    ENDEXEC.
    EXEC SQL.
      disconnect 'MYDB'
    ENDEXEC.
    How can i get the data from that date?? If i delete the where statemet, the program works well, it takes 30 mins and show all the data, I just need the data from that date.
    Any help
    Regards

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • Table are not prefixed with Schema in  SQL request - Unable to get Data

    I began this new thread because I closed the [previous one|Unable to get data (DSN connection); a little bit early, I believed it was OK but no the problem still here.
    First my architecture :
    Oracle 9g
    +500 Reports made under CR developper 8.5 or 9.0
    Report opened in VB .net application, framework 2.0 using CR runtime 8.5 and 9.0
    We want to upgrade CR version to 2008, so modification of reports will be done with CR 2008 Developper, and we want to
    use only CR 2008 runtime.
    The problem :
    Everything works fine in CR Developer, but the same report with the same parameters failed when called inside .net.
    The error is "Unable to get data", the database connection is OK but the queries mades from inside the report are wrong :
    The tables/views in the from statement are not prefixed with the Schema, so Oracle don't find them.
    Example (SQL monitoring done with TOAD)
    Execution of postes.rpt report directly in CR :
    Timestamp: 10:30:03.881
    Successful logon attempt (session tag: 0x6464CB8)
    username: 'APPLI_HUET'; database: 'DEV'
    SELECT ...
    FROM  "COMMUN"."ETAB" "ETAB" INNER JOIN "GESTION_DES_TEMPS"."POSTES" "POSTES"
    ON "ETAB"."N_ETAB"="POSTES"."N_ETAB"
    WHERE  "POSTES"."N_ETAB"=2 ORDER BY "POSTES"."N_POSTE"
    Timestamp: 10:50:29.178
    Logoff (session tag: 0x6464CB8).
    Same report, same authentication but throught .net program :
    Timestamp: 11:01:24.569
    Successful logon attempt (session tag: 0xA93FC38)
    username: 'APPLI_HUET'; database: 'DEV'
    SELECT ...
    FROM   "ETAB" "ETAB" INNER JOIN "POSTES" "POSTES"
    ON "ETAB"."N_ETAB"="POSTES"."N_ETAB" WHERE  "POSTES"."N_ETAB"=2 ORDER
    BY "POSTES"."N_POSTE"
    Runtime error occurred: 942 (ORA-00942: Table ou vue inexistante)
    The .net code :
    Dim _report As New ReportDocument()
    _report.Load("report.rpt", OpenReportMethod.OpenReportByDefault)
    Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
    myConnectionInfo.ServerName = "DSN_file"
    myConnectionInfo.UserID = p_Userid
    myConnectionInfo.Password = p_Password
    ' to see code in this method se my original post
    SetDBLogonForReport(myConnectionInfo, _report)
    SetDBLogonForSubreports(myConnectionInfo, _report)
    Dim frmViewer As New CrystalReportViewer
    frmViewer.CrystalReportViewer1.ReportSource = _report
    frmViewer.Show()
    Any ideas ?

    Thanks for the and sorry but I don't understand.
    I've made a research of Location on this forum the more intersting thread I've found is rpt-files do not function anymore after deploying to a different database, but I still don't understand.
    I take a look at all code sample and I can't found anything.
    You say that .Location need to be set, indeed Location property of CrystalDecisions.CrystalReports.Engine.Table object only contains table name.
    I tried to overrides this value by the fully qualified table name (ie Schema.Table, for example GESTION_DES_TEMPS.POSTES), and it work  BUT it wouldn't be the solution, my code is designed to be generic, I can't have a database to know wich schema add before differents table name.
    Why when we execute the report directly in CR 2008 developper we don't have to redefine the table location ?
    Another test :
    I've made a new report directly in CR 2008 with a DSN, launch it in .net with the same DSN (server) : OK
    Then I launch it in .net with another DSN, it work also.
    Why report done with Crystal 8.5 or 9.0 have this problem ?
    I'me gonna be mad....
    Edited by: Yoann DAVID on Jan 8, 2010 3:32 PM

  • Need to get data for specific user logged in

    Hi All,
    I need some pointers for the sql query. I have a query that extracts approval history information along with current status of person who submitted for changes of his direct reportee.
    what I need is to get the only the approval data of logged in person( top to bottom/bottom to top persons involved) in approval process.
    we built the report, but it gets all of the approvals data from HRSS related tables.
    I need to get the data of person who logged in.
    is this possible? can someone please provide some pointers?
    Thanks in advance..

    @Pablolee, Thanks for the reply
    Pointer number 1.
    Provide a (working)test case so that your requirements are clear.
    -- scenario
    lets say we have   Manager1, Manager2, Manager3
    Here is test case
       Manager1 - Submitted person salary change and went for approval. In this approval process It went upto manager level say Manager3.
    the sql query i have gets all approval process data of all other's manager's involved in whole approval process. as Manager1 when i logged in I wanted to see where this salary change record is pending i.e Manager3.
    but my query show all others data also. can you tell me how to get Manager1(top to bottom OR bottom to top of this person logged in) change record submitted data in approval process.
    I hope you understand this, If possible please let me know how to achieve this.
    Thx..

Maybe you are looking for

  • What is the best way to keep a MacBook Pro backed up?

    I'm about to buy a MacBook Pro for my daughter who is about to start University.  She will need to back up her work of course, so I'm wondering what is the best way to back up a MacBook? At home I have my iMac which is backed up to a WD Studio II 2TB

  • Hairline crack around backside of LCD hinge

    Hello, all. Does any Apple support people read this discussion group? I would like to let them know about my issue. I bought my MacBook early this year. It is a white MacBook. Problem is that it started to show hairline crack around the bottom side o

  • Creating dim, cube based on SOLVED LEVEL-BASED Dims

    Hi All, I have generated parent child script using cwm2_olap_pc_transform.create_script. After running this generated script, it has created 3 table/view. My Base Parent Child table is like this:- drop table PARENT_CHILD; create table PARENT_CHILD (P

  • Do we need nodemanager for SOA server installation?

    Hi All, I am installing both Weblogic Server ans SOA suite (SOA Server) in the same machine. What I red on net and nodemanager is required if managed server is installed on a different machine from the machine where weblogic server is installed. So i

  • Cannot Print - "My Document" folder opens to save the page as a TIFF

    Windows XP SP Firefox: 3.6.3 For no apparent reason, when I want to print a Web page (whether or not there are images, it opens the "save as" dialogue box and the TIFF option is checked (there are no other optons). If I save it "Microsoft Office Pict