How can include '*' option in a query

Hi,
I have an input field for Material number , and this is used in a join to fetch data , my problem is some times user will enter material number as 456* , in this case how can i change the query.
Please see the join,
  select dmatnr as material dwerks as plant dlgort as slocation dumlme dlabst rmeins  k~maktx as descr
                      into corresponding fields of table it_data2
                      from mard as d inner join mvke as m
                      on dmatnr = mmatnr
                      inner join mara as r
                      on rmatnr = dmatnr
                      inner join makt as k
                      on kmatnr = dmatnr
                      *where d~matnr= lv_matnr*
                      and d~werks in r_plant
                      and m~vkorg in r_sales.
Regards,
Ratheesh BS

Hi,
Use this:
select d~matnr as material d~werks as plant d~lgort as slocation d~umlme d~labst r~meins k~maktx as descr
into corresponding fields of table it_data2
from mard as d inner join mvke as m
on d~matnr = m~matnr
inner join mara as r
on r~matnr = d~matnr
inner join makt as k
on k~matnr = d~matnr
where d~matnr like '456%'
and d~werks in r_plant
and m~vkorg in r_sales.

Similar Messages

  • How can i know if my query is using the index ?

    Hello...
    How can i know if my query is using the index of the table or not?
    im using set autotrace on...but is there another way to do it?
    thanks!
    Alessandro Falanque.

    Hi,
    You can use Explain Plan for checking that your query is using proper index or not. First you need to check that Plan_table is installed in your database or not. If it is not there THEN THE SCRIPT WILL BE LIKE THIS:
    CREATE TABLE PLAN_TABLE (
    STATEMENT_ID VARCHAR2 (30),
    TIMESTAMP DATE,
    REMARKS VARCHAR2 (80),
    OPERATION VARCHAR2 (30),
    OPTIONS VARCHAR2 (30),
    OBJECT_NODE VARCHAR2 (128),
    OBJECT_OWNER VARCHAR2 (30),
    OBJECT_NAME VARCHAR2 (30),
    OBJECT_INSTANCE NUMBER,
    OBJECT_TYPE VARCHAR2 (30),
    OPTIMIZER VARCHAR2 (255),
    SEARCH_COLUMNS NUMBER,
    ID NUMBER,
    PARENT_ID NUMBER,
    POSITION NUMBER,
    COST NUMBER,
    CARDINALITY NUMBER,
    BYTES NUMBER,
    OTHER_TAG VARCHAR2 (255),
    PARTITION_START VARCHAR2 (255),
    PARTITION_STOP VARCHAR2 (255),
    PARTITION_ID NUMBER,
    OTHER LONG,
    DISTRIBUTION VARCHAR2 (30))
    TABLESPACE SYSTEM NOLOGGING
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 10240
    NEXT 10240
    PCTINCREASE 50
    MINEXTENTS 1
    MAXEXTENTS 121
    FREELISTS 1 FREELIST GROUPS 1 )
    NOCACHE;
    After that write the following command in the SQL prompt.
    Explain plan for (Select statement);
    Select level, SubStr( lpad(' ',2*(Level-1)) || operation || ' ' ||
    object_name || ' ' || options || ' ' ||
    decode(id, null , ' ', decode(position, null,' ', 'Cost = ' || position) ),1,100)
    || ' ' || nvl(other_tag, ' ') Operation
    from PLAN_TABLE
    start with id = 0
    connect by
    prior id = parent_id;
    This will show how the query is getting executed . What are all the indexes it is using etc.
    Cheers.
    Samujjwal Basu

  • How can i display all the query items to a table?

    how can i display all the query items to a table in a jsp file?
    i always have an out of memory error..

    any body??any idea?
    is it possible thru configuration or i have to write a program by the abaper??
    Biswa

  • How can i join this two query?

    I have two table table employee and CSEReduxResponses
    In table employee i have
    CREATE TABLE [dbo].[employee](
    [emp_id] [int] IDENTITY(1,1) NOT NULL,
    [emp_namefirst] [varchar](255) NOT NULL,
    [emp_namemiddle] [varchar](50) NULL,
    [emp_namelast] [varchar](255) NOT NULL
    on responds i have 
    CREATE TABLE [dbo].[CSEReduxResponses](
    [response_id] [int] IDENTITY(1,1) NOT NULL,
    [employee] [int] NOT NULL,
    [employeedept] [int] NOT NULL,
    [star] [tinyint] NOT NULL,
    [status] [int] NOT NULL,
    [approvedby] [int] NULL,
    [approveddate] [datetime] NULL,
    [execoffice_status] [int] NULL,
    Im trying to get the employee with the MAX execpffice_status( this is either a 1 or 0).
    i have this query that i made for it
    select top(1) with ties employee, SUM(execoffice_status) as 'total'
    from   CSEReduxResponses
    group by employee
    order by 'total' desc
    my query for employee table is 
       select emp_namefirst as first , emp_namelast as [last]
    from phonelist.dbo.employee where emp_namefirst is not null
    How can i get this 2 query together so i can output the employee (first and last )name
    with the max exeoffice_status?
    i use :
    Microsoft SQL Server Management Studio 10.0.2531.0
    ps: sorry if i put this is the wrong forum, this is my first time here and first post.

    Are you looking for the below?
    CREATE TABLE [dbo].[employee](
    [emp_id] [int] IDENTITY(1,1) NOT NULL,
    [emp_namefirst] [varchar](255) NOT NULL,
    [emp_namemiddle] [varchar](50) NULL,
    [emp_namelast] [varchar](255) NOT NULL
    Insert into Employee Values('abc','bcd','cdf')
    Insert into Employee Values('xyz','yxw','xwv')
    CREATE TABLE [dbo].[CSEReduxResponses](
    [response_id] [int] IDENTITY(1,1) NOT NULL,
    [employee] [int] NOT NULL,
    [employeedept] [int] NOT NULL,
    [star] [tinyint] NOT NULL,
    [status] [int] NOT NULL,
    [approvedby] [int] NULL,
    [approveddate] [datetime] NULL,
    [execoffice_status] [int] NULL,
    Insert into [CSEReduxResponses]( employee,employeedept,star,status,approvedby,approveddate,execoffice_status)
    Values(1,100,1,1,1,GETDATE(),0),
    (1,100,1,1,1,GETDATE(),1),
    (2,100,1,1,1,GETDATE(),0)
    ;With cte as( Select *,SUM([execoffice_status]) over(partition by Employee) sumstatus From [CSEReduxResponses] )
    Select Distinct A.*,B.sumstatus
    From Employee A
    Inner Join cte B On A.emp_id = B.employee
    --OR
    ;With cte as( Select employee ,SUM([execoffice_status]) sumstatus From [CSEReduxResponses] group by Employee)
    Select Distinct A.*,(Select sumstatus From cte B where A.emp_id = B.employee)
    From Employee A
    Drop table Employee,[CSEReduxResponses]

  • How Can I make the following query faster

    Hi Guru
    I want your valuable suggestion to make the following query faster.I did not write all required columns list. I gave here all those columns where I have conditon like decode,case when,or subquery
    (SELECT CASE WHEN REPORTED_BY IS NULL THEN
              (SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.EMP_NO_RADIO)
         ELSE (SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.REPORTED_BY) END RADIOLOGIST_NAME,
         (SELECT TEAM_NAME FROM DC_TECHTEAMMST WHERE TEAM_NO = M.GROUP_NO) GROUP_NAME,
         CASE WHEN M.RESULT_ENTRY_LOCK_BY IS NOT NULL THEN 'R'
    WHEN M.REPORT_DONE = 'D' THEN 'D'
    WHEN M.REPORT_DONE = 'P' THEN 'P'
    WHEN M.REPORT_DONE = 'F' THEN 'F'
         WHEN NVL(M.IMG_CAPTURED,'X') NOT IN ('B','Y') OR M.QA_RESULT = 'F' THEN 'S'
    WHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') NOT IN ('B','P') THEN 'Q'
         wHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') IN ('B','P') THEN 'C'
    END STATUS,
         (SELECT DECODE(NVL(V.DELIVERY_STATUS,'N'),'E',3,'U',2,1)
              FROM FN_VOUCHERCHD V WHERE V.VOUCHER_NO = M.VOUCHER_NO AND V.ITEM_NO = M.TEST_NO) DELIVERY_STATUS,
         trunc((start_time-order_end)*24,0)||' hr'||':'||
         decode(length(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)),2,to_char(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0))
              ,1,to_char('0'||trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)))||' mi' duration_order_capture,
         DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',NVL(R.NAME,R.name_lang_name||' '||R.name_lang_fname)) PAT_NAME,
         FNC_PATIENTAGE(R.REG_NO,'',R.CONFIDENTIAL_PATIENT) pat_age,
         DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',R.PATIENT_SEX) PAT_SEX
    FROM DC_MODALITYAPPOINTMENT M,DC_TESTMST T,OP_REGISTRATION R
    WHERE M.ACCESSION_NO IS NOT NULL AND NVL(M.CANCEL_FLAG,'N') = 'N'
    AND (NVL(T.SP_GEN,'S') = 'S' OR NVL(M.DOC_REQ_GEN,'N') = 'Y')
    AND M.TEST_NO IS NOT NULL AND M.TEST_NO = T.TEST_NO AND M.REG_NO = R.REG_NO)
    How can I make the above query faster.
    Query condition or indexing whatever is preferable please guide me.
    The approximate data of tables
    DC_MODALITYAPPOINTMENT 2,000,000
    A lot of updating is going on some columns of this table.all columns are not in the select list, Insertion is happend in batch process by back-end trigger of another table.
    Primary key based one column,
    OP_REGISTRATION 500,000
    Daily insertion on this table around 500 records,updation is not much.
    Primary key based one column 'reg_no'
    DC_TESTMST
    Total records of this table not more than 1500.This is setup table. Insertion and updation is not much on this table also
    I have to create a view based on this query .
    and I have to create another view to serve another purpose.
    In the 2nd view I need this query as well as I need another query by using union all operator based on a table(dc_oldresult)
    which have 1,600,000 records.There is no DML on this table
    SELECT      NVL((SELECT USER_DEFINE_TEST_NO FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ),SV_ID) USER_D_EXAM_NO,
    (SELECT TEST_TYPE FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ) EXAM_TYPE,
         NVL((SELECT TEST_NAME FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1),'Exam Code: '||sv_id) EXAM_NAME,
         (SELECT PAT_NAME FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_NAME,
         (SELECT PAT_AGE FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_AGE,
         (SELECT PAT_SEX FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_GENDER
    FROM DC_OLDRESULT
    WHERE HN IS NOT NULL AND SV_ID IS NOT NULL AND UPPER(ACTIVE) = 'TRUE'
    Should I make join DC_OLDRESULT, OP_REGISTRATION and DC_TESTMST? or The eixisting subquery is better?
    I use OP_REGISTRATION and DC_TESTMST in both query
    Thanks in advance
    Mokarem

    When your query takes too long ...

  • How can I make this complex query?

    I don’t know how can I do this complex query...
    I have the tables Customers, Vehicles and Models. A customer can have 0-N Vehicles and a vehicle have 1 Model.
    Customers: ID_Customer (PK), Name, LastName...
    Vehicles: ID_Vehicle (PK), ID_Customer, ID_Model, date_sale
    Models: ID_Modelo (PK), Model_Name
    Then I need to know the buy average time (date_sale) between 2 models (ID_Model)
    For example I have these Vehicles:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    1................................123....................1.............21/05/2000
    2................................459....................3............ 16/08/2000
    3................................123....................2............ 28/06/2001
    4................................516....................1............ 09/09/2001
    5................................459....................4............ 18/10/2002
    6................................516....................2............ 20/12/2002
    If I want to know the buy average time (date_sale) between ID_Model 1 and ID_Model 2 it is. (403 + 467) / 2 = 435 days !!!
    * Customer 123 (model 1 to 2): 25/06/2001 – 21/05/2000 ==> 403 days
    * Customer 516 (model 1 to 2): 01/12/2002 – 01/05/2000 ==> 467 days.
    I need to do the query for all the combination models. For example If I have the Models 1, 2 and 3 I need to obtain:
    Source_Model.....Target_Model....Buy_Average_Time
    1......................................1....................... xxx days
    1......................................2....................... xxx days
    1......................................3....................... xxx days
    2......................................1....................... xxx days
    2......................................2....................... xxx days
    2......................................3....................... xxx days
    3......................................1....................... xxx days
    3......................................2....................... xxx days
    3......................................3....................... xxx days
    If it is necessary I could create a table with the fields Source_Model, Target_Model and Buy_Average_Time for accelerate the query time response.
    But how can I do this query??????????
    Thanks very much!!!

    Hi,
    Thanks for your reply but It is not correct for me because the Customer could have several vehicles in her life.
    If I make the query with my examples data it is OK
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    1................................123....................1.............21/05/2000
    2................................459....................3............ 16/08/2000
    3................................123....................2............ 28/06/2001
    4................................516....................1............ 09/09/2001
    5................................459....................4............ 18/10/2002
    6................................516....................2............ 20/12/2002
    select v1.id_model as source_model,
    v2.id_model as target_model,
    avg (v2.date_sale - v1.date_sale) || ' days' as buy_average_time
    from vehicles v1,
    vehicles v2
    where v1.id_customer = v2.id_customer
    and v2.date_sale > v1.date_sale
    group by v1.id_model, v2.id_model;
    I received:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2.....................................435 days
    ..............3................................4.....................................793 days
    But If I insert a new vehicle:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    7................................516....................3............ 16/08/2003
    And I execute the query now I receive:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2...........................435 days
    ..............1................................3...........................706 days
    ..............2................................3...........................239 days
    ..............3................................4...........................793 days
    It is NO correct because I don’t have the 1 (Source_model) to 3 (Target_model) combination in the Vehicles data!!! (I have 1 to 2 and 2 to 3 but NO 1 to 3!!!!).
    Then the query is not OK for me!
    Besides If I modify the Vehicle 7 data and put ID_Model = 2:
    ID_Vehicle (PK)...ID_Customer...ID_Model....date_sale
    7................................516....................2............ 16/08/2003
    I received:
    SOURCE_MODEL     TARGET_MODEL     BUY_AVERAGE_TIME
    ..............1................................2...........................525,33 days
    ..............2................................2...........................239 days
    ..............3................................4...........................793 days
    It is NO correct because the BUY_AVERAGE_TIME for 1 to 2 combination is 435 days (the same of the original query) because I aggregate only the combination 2 to 2 with the ID_VEHICLE 7
    Below I attach the examples scripts.
    Could you help me with this query, please?
    Thanks very much!
    CREATE TABLE VEHICLES
    ID_VEHICLE NUMBER(9),
    ID_CUSTOMER NUMBER(9),
    ID_MODEL NUMBER(9),
    DATE_SALE DATE
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    1, 123, 1, TO_Date( '05/21/2000 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    2, 459, 3, TO_Date( '08/16/2000 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    3, 123, 2, TO_Date( '06/28/2001 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    4, 516, 1, TO_Date( '09/09/2001 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    5, 459, 4, TO_Date( '10/18/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    6, 516, 2, TO_Date( '12/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO VEHICLES ( ID_VEHICLE, ID_CUSTOMER, ID_MODEL, DATE_SALE ) VALUES (
    7, 516, 2, TO_Date( '08/16/2003 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    COMMIT;
    CREATE TABLE MODELS
    ID_MODELO NUMBER(9),
    MODEL_NAME VARCHAR2(25 BYTE)
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    1, 'MODEL 1');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    2, 'MODEL 2');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    3, 'MODEL 3');
    INSERT INTO MODELS ( ID_MODELO, MODEL_NAME ) VALUES (
    4, 'MODEL 4');
    COMMIT;
    CREATE TABLE CUSTOMERS
    ID_CUSTOMER NUMBER(9),
    NAME VARCHAR2(25 BYTE),
    LASTNAME VARCHAR2(25 BYTE)
    TABLESPACE USERS
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    123, 'Customer 123', 'A');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    459, 'Customer 459', 'B');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    516, 'Customer 516', 'C');
    INSERT INTO CUSTOMERS ( ID_CUSTOMER, NAME, LASTNAME ) VALUES (
    318, 'Customer 318', 'D');
    COMMIT;

  • How can payment option of app store can be disabled

    how can payment option of app store can be disabled

    Set Payment Type to NONE
    Settings>Store>Apple ID>Payment Information>Payment Type

  • How to include 0STOCK_VAL in a Query based on APO DataSource?

    Hi All,
    I have a requirement to include *0STOCK_VAL" from Inventory to the APO InfoCube. But the problem with this is, this particular KeyFigure is not present in the APO hence it cannot be included in the APO DataSource i.e. we cannot get this from the Source System.
    I checked the Production system, 0STOCK_VAL InfoObject is avaiable in one of the InfoCube but it is not present in any DSO's. Since it is not present in any of the DSO's we cannot write a Routine to read it from any of the table.
    I even thought of including the InfoCube where 0STOCK_VAL is present into a MultiProvider along with the APO InfoCube. I can define the joining condition based on Plant and Material. But if I drill down any other characteristics which are not common in both the  InfoCube then we will have a blank line in the Query which is not recommended.
    But this KeyFigure is very much needed in the Query.
    My question is how to include this in the APO InfoCube or How to get this in the Query with values??
    Can anybody please help me on this.
    Thanks in advance.
    Prasapbi

    hi Matt,
      In your example like a transaction was paid for with a payment type of PTAM, then you need all the transaction details. I suppose that all the required transaction details along with payment type PTAM will be loaded into an infoprovider and you run a report on top of this infoprovider. Then for that report you need to have a selection screen variable for Payment Type and if the user enters the payment type PTAM, then he can get all the other transaction details from the infoprovider.
    Let me know if i don't understand the requirement correctly.
    Hope it helps....

  • How to include optional NI-Device installation in my installer

    I have a Wise installation script. How do I offer customers the option of installing NI-Device? I could make a C++ program and run it, but don't know how it would work. I see a file named SilentInstall.txt on the NI-Device 1.5 disk, but it just looks like an ini file. Any help appreciated.

    Thanks for your helpful reply. However, I'm finding that the NI-Device installation program (setup.exe) ignores my silentinstall.txt and just installs everything. Since my installer will copy almost the entire NI-Device CD (with my modified silentinstall.txt) to the user's disk and then command "setup.exe /q silentinstall.txt /r", I'm testing by running from the Start->Run window. But although the installation is silent and doesn't automatically reboot, I find that everything gets installed.
    Attached is my silentinstall.txt. Note that I have "absent" for every NI-Spy option, yet NI-Spy gets installed anyway. How can I make setup.exe pay attention to the silentinstall.txt? (Windows NT, NI-Device 1.5).
    Gary
    Attachments:
    SilentInstall.txt ‏1 KB

  • How can I optionally boot into X?

    I've got a laptop which I'd like to boot into X most of the time but also have the option to boot to the command line, how can I do this?
    I use grub so I was thinking that it could be through there somehow by passing parameters to the kernel but I don't know what I'd pass or how I would interpret it once booting had started.
    Can anyone suggest a way to do it?

    Put something like this in your ~/.bash_profile :
    if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then
    startx
    logout
    fi
    This will start X when that user logs into console 1 , but goes to command line when logging in on console 2,3,4,5,6 .
    Taken from Start_X_at_boot

  • How can I access to a query

    Hello,
    I have not so much experience in WebDynPro but I must do something in it. Does anybody of you know, how I can acces to a BW query in in WebDynPro?
    I have read in some books, but I have not found anything to do this.
    If somebody can help me, I'm very happy.
    Thanks,
    Peter

    Peter,
    Take a look at this [tutorial|http://help.sap.com/javadocs/NW04S/SPS08/bi/howtos/How_To_BI_Java_SDK_WebDynpro_App.pdf]
    Also check Patrick's reply in this thread : Access BW data (query) iinto WebDynpro
    Additional documentation available [here|http://help.sap.com/javadocs/NW04S/SPS08/bi/documentation.html]
    Chintan.

  • How Can I Make This Sql Query To Load Data Correctly (sql server)?

    Hi guys
    I have a datagridview where the third column is a custom column with all days
    of a month. It takes data with a query who distinct the column Improve.
    Here is the code :
    Private Sub fill_impro()
    dgImprove.Rows.Clear()
    Try
    Dim i As Integer = 0
    Dim query As String = "SELECT Improve,Price,Active,Idate FROM (SELECT Improve,Price,Active,Idate, ROW_NUMBER() OVER (PARTITION BY Price ORDER BY Price) AS rn FROM tblImprove) tmp WHERE rn = 1"
    cmd = New SqlCommand(query, clsMSSQL.con)
    myDR = cmd.ExecuteReader
    If myDR.HasRows Then
    While myDR.Read
    dgImprove.Rows.Add()
    dgImprove.Rows(i).Cells(0).Value = myDR.GetDecimal(myDR.GetOrdinal("Price"))
    dgImprove.Rows(i).Cells(1).Value = myDR.GetString(myDR.GetOrdinal("Improve"))
    Dim myday As Integer = DatePart(DateInterval.Day, myDR.GetValue(myDR.GetOrdinal("Idate")))
    dgImprove.Rows(i).Cells(myday + 1).Value = myDR.GetInt32(myDR.GetOrdinal("Active"))
    i = i + 1
    End While
    End If
    myDR.Close()
    Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical, "Σφάλμα")
    End Try
    End Sub
    And here is the result :
    http://i60.tinypic.com/28gwf83.jpg
    The column Active value is 1.
    The problem is that column Active values are missing (red values in image).
    How can i fix that ?
    Thanks in advance

    try like this
    Dim Price As Decimal
    Dim improve As String = String.Empty
    While myDR.Read
    Dim myday As Integer = DatePart(DateInterval.Day, myDR.GetValue(myDR.GetOrdinal("Idate")))
    If Not (myDR.GetDecimal(myDR.GetOrdinal("Price")) = Price And myDR.GetString(myDR.GetOrdinal("Improve")) = improve) Then
    i += 1
    dgimprove.Rows.Add()
    dgimprove.Rows(i).Cells(0).Value = myDR.GetDecimal(myDR.GetOrdinal("Price"))
    dgimprove.Rows(i).Cells(1).Value = myDR.GetString(myDR.GetOrdinal("Improve"))
    Price = myDR.GetDecimal(myDR.GetOrdinal("Price"))
    improve = myDR.GetString(myDR.GetOrdinal("Improve"))
    End If
    dgimprove.Rows(i).Cells(myday + 1).Value = myDR.GetInt32(myDR.GetOrdinal("Active"))
    End While
    and change your sql statement to just
    SELECT Improve,Price,Active,Idate FROM tblImprove WHERE Active = 1

  • How Can I Make This Sql Query To Load Data Correctly (sql server 2014)?

    Hi guys
    I have a datagridview where the third column is a custom column with all days
    of a month. It takes data with a query who distinct the column Improve.
    SELECT Improve,Price,Active,Idate FROM (SELECT Improve,Price,Active,Idate, ROW_NUMBER() OVER (PARTITION BY Improve ORDER BY Improve) AS rn FROM tblImprove) tmp WHERE rn = 1
    And here is the result :
    http://i60.tinypic.com/28gwf83.jpg
    The column Active value is 1.
    The problem is that column Active values are missing (red values in image).
    How can i fix that ?
    Thanks in advance
     

    Hi, 
    Maybe you can try below code, I have changed the order by of the row_number(). Therefore it will sort on the date, and you will get the first date icm with improve cell. If this is not what you are looking for, please explain what the output should be. 
    SELECT Improve,Price,Active,Idate
    FROM
    SELECT Improve,Price,Active,Idate, ROW_NUMBER() OVER (PARTITION BY Improve ORDER BY ldate) AS rn
    FROM tblImprove
    ) tmp WHERE rn = 1
    Regards, 
    Reshma
    Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered

  • How can i refresh view on query after changing the query?

    Hi,
    i built few view's on 1 query in BI7. after i made a change in the query i haven't seen it in the view, why?
    it's not refreshing automaticly from the query? and if it's not, how can i refresh the view?
    thanks
    Meirav
    Edited by: Meirava on Apr 2, 2009 11:43 AM

    Hi,
        You need to refresh that view and once again save the view with changed settings. Then it will brings according to the query changes.Once check the variables also.
    Regards
    Pcrao.

  • How can I change the report query source on the fly

    I am new to Bi Publisher,
    I have a user that wants to select certain columns in the table then have bi publisher make a pdf on just those columns
    without making different reports for each of there choices, how can i make the report variable?
    Thanks,
    Doug

    Hi Doug,
    You can also use lexical parameters to determine the columns in a Data Template (or Oracle Report)... taking it to the extreme the major components of a BI Publisher data template could be dynamic.... something like:
    select &select_clause
    from &from_clause
    where &where_clause
    Regards,
    Gareth
    http://garethroberts.blogspot.com
    http://www.virtuate.com

Maybe you are looking for

  • IC WEBCLIENT: Access via 'NULL' object reference not possible

    Hi, Iam working in ABAP, and learning CRM ABAP on CRM5.0 IDES Demo system I was trying to create a new WebIC by copying one view from CRM_IC to ZCRM_IC bsp application. Following are the steps I following according to Cook book documentation. 1. I co

  • DW 8 - Inline Frame TOP alignment

    Greetings, I have a table with couple columns. Left column has Iframe of text links. Basically my navigation links for my site. Next colums are just editible regions. Problem is that my left cell with iFrame top text is lower than my next columns tex

  • How to use a Local Clipboard in a TransferHandler

    I'm working on a system that needs to restrict cut, copy and paste to a single JVM. I have assumed that I will need to deny access to the system clipboard and use a local one instead. I've tried using a TransferHandler but cannot find a way of making

  • Memory grows in javaw.exe but not in java.exe process

    Hi, I'm testing some heavy emoticons(most of them are animated). Emoticons are shown in a popmenu, each emoticon is inside a JLabel with borders that are draw on mouse over. These JLabels are in a GridLayout. The test itself consists in pressing repe

  • How can I add interactivity to a StringItem with appearance mode HYPERLINK

    Hi Everyone, I have BB 8520 Curve Smartphone. I have installed apps like facebook and gmail on it. I found that it can show the StringItem with appearance mode HYPERLINK and BUTTON. User can directly go to it and press the optical touch button, which