Query that provides combination of data that meet a certain criteria

I am trying to find a combination of rows that combine to meet a criteria.
I have a table with columns Length , Width and No of pieces. Each row represents one rectangular piece and its quantity.
The entries are like 300 600
30
                                400
300 10............etc.
I want the user to give input like necessary rectangular length = 1000 and necessary rectangular width = 500 and the query can give me all possible combinations from available rectangular pieces that combine to form this necessary rectangle and if not, print
an error.
If a code is required instead of query (which i think it is) please advice the code and how to attach a code to Microsoft access file as an addin.
Thanks

Thanks guys for the help.
Just to clarify what I am looking for, here are the tables. The main table from access database is - 
                   Length
                   Width
                     No of Available pieces
300
600
20
600
400
10
900
600
5
………..the list is very long.
User enters the value : Length Needed = 900 , Width needed = 1200
Query gives this output -
Option 1
                Length
                  Width
                      No of needed pieces
300
600
6
Option 2
               Length
                  Width
                         No of neede pieces
900
600
2
Option 3
                 Length
                  Width 
                        No of needed pieces
900
600
1
300
600
3
………so on

Similar Messages

  • Need a photosharing site that meets a few criteria.

    Hiya!
    I used to really like the .Mac photo sharing abilities, but of course they are all closed up now.  I am a member of Flickr, SmugMug and Photobucket, but none can do the simple task that I require.
    1)  I want to be able to upload full resolution versions of my pics.
    2)  I want other people to be able to upload their pics into my gallery.  For example, a family trip.  Need to be able to have multiple people upload.
    3)  Need one click download of entire galleries for myself and my visitors.
    4)  Download has to be the original file/files at full resolution (no name changes or other alterations). 
    .Mac used to do this all seamlessly.  All of the sites that I have joined have some of these features, but none has all of them.
    Any suggestions on where I should look next?
    Cheers!

    I meant it's a question that could be more successfully answered there than here. Or perhaps on one of the larger photographic communities, like Preview. Our focus here is pretty narrow.

  • Query for getting combination of data

    hi all,
    i am using db10g.
    i have a table of fields a_company,a_code,a_name,a_port,a_t_port,a_rate,a_volume
    i have a records like
    MM,AA,A-NAME,EFG,EFGH,100,20
    MM,AA,A-NAME,EFG,EFGH,200,10
    MM,BB,B-NAME,HIJ,HIJK,100,20
    MM,BB,B-NAME,HIJ,HIJK,200,30
    MM,CC,C-NAME,DEF,DEFG,500,20i have to select all columns but the fields if below below combination repeates(having more than 1 combination)
    a_company,a_code,a_port,a_t_port
    how can form a query?
    in other words i am expecting the result like below among above said input.
    MM,AA,A-NAME,EFG,EFGH,100,20
    MM,AA,A-NAME,EFG,EFGH,200,10
    MM,BB,B-NAME,HIJ,HIJK,100,20
    MM,BB,B-NAME,HIJ,HIJK,200,30Thanks..

    With only one table scan:
    SQL> create table a_table (a_company,a_code,a_name,a_port,a_t_port,a_rate,a_volume)
      2  as
      3  select 'MM','AA','A-NAME','EFG','EFGH',100,20 from dual union all
      4  select 'MM','AA','A-NAME','EFG','EFGH',200,10 from dual union all
      5  select 'MM','BB','B-NAME','HIJ','HIJK',100,20 from dual union all
      6  select 'MM','BB','B-NAME','HIJ','HIJK',200,30 from dual union all
      7  select 'MM','CC','C-NAME','DEF','DEFG',500,20 from dual
      8  /
    Table created.
    SQL> exec dbms_stats.gather_table_stats(user,'a_table')
    PL/SQL procedure successfully completed.
    SQL> set autotrace on explain
    SQL> select a_company
      2       , a_code
      3       , a_name
      4       , a_port
      5       , a_t_port
      6       , a_rate
      7       , a_volume
      8    from ( select a.a_company
      9                , a.a_code
    10                , a.a_name
    11                , a.a_port
    12                , a.a_t_port
    13                , a.a_rate
    14                , a.a_volume
    15                , count(*) over (partition by a_company,a_code,a_port,a_t_port) cnt
    16             from a_table a
    17         )
    18   where cnt > 1
    19  /
    A_ A_ A_NAME A_P A_T_     A_RATE   A_VOLUME
    MM AA A-NAME EFG EFGH        100         20
    MM AA A-NAME EFG EFGH        200         10
    MM BB B-NAME HIJ HIJK        100         20
    MM BB B-NAME HIJ HIJK        200         30
    4 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=5 Bytes=330)
       1    0   VIEW (Cost=4 Card=5 Bytes=330)
       2    1     WINDOW (SORT) (Cost=4 Card=5 Bytes=140)
       3    2       TABLE ACCESS (FULL) OF 'A_TABLE' (Cost=2 Card=5 Bytes=140)Regards,
    Rob.

  • Query that only returns certain fields in Java

    Currently I'm using a filter that identifies some keys, I then get all the keys and get a single value from each object. The rest of the object is quite large. I've seen references in passing on the ability to do this, using CohQL but I can't get it to work from Java.
    Basically, I want to do: "Select field from "Cache" where key='asdf'". I just want to get back the specific "field" rather than the whole object. How do I do this?
    Thanks.

    Hi,
    It should be easy if your object has a getField() accessor. Hope this helps ...
    http://download.oracle.com/docs/cd/E15357_01/coh.360/e15723/api_cq.htm#CEGDIJEC
    Using Path-Expressions
    One of the main building blocks of CohQL are path-expressions. Path expressions are used to navigate through a graph of object instances. An identifier in a path expression is used to represent a property in the Java Bean sense. It is backed by a ReflectionExtractor that is created by prepending a get and capitalizing the first letter. Elements are separated by the "dot" (.) character, that represents object traversal. For example the following path expression is used to navigate an object structure:
    a.b.c
    It reflectively invokes these methods:
    getA().getB().getC()
    For example ...
    Select the home state and age of employees in the cache ContactInfoCache, and group by state and age.
    select homeAddress.state, age, count() from "ContactInfoCache" group by homeAddress.state, age

  • ERD software that meets these needs?

    I'm looking for ERD software that meets the following criteria. I've been using JDeveloper but finding it lacking in these areas. Perhaps someone can enlighten me with a hidden setting to solve any of these?
    1. I have made an ERD for my database, but a year has passed and it needs to be updated: I want to import the changes in such a way that neither the relative locations of the tables nor the lines are moved. I've been using Oracle JDeveloper, this is fine for tables but my lines turn to spaghetti and I have to re-position all of them whenever I sych changes from the DB.
    2. Can add text to the diagram, like a title and date, and can draw shapes on the diagram, like a rectangle around a group of tables to highlight that they are related. (I didn't find this in JDeveloper, so I was importing the document into Adobe Illustrator to add text and other shapes.)
    3. saves correctly in .svg (open source vector format). If I recall correctly, JDeveloper will save in .svg but each time I tried it was a dirty/malformatted write such that other .svg readers couldn't open it correctly. Adobe Illustrator is pretty smart, so it could open it, but I couldn't view it in Firefox with the svg viewer add-on.
    Thanks!

    Gene,
    1. JDeveloper does not support pure ERD logical modeling. However, as you say you want to synch from the database I take it you are wanting to work at the physical level. Having said that, in the latest release of JDeveloper you can do ERD/logical modeling using a UML Class diagram and then 'transform' that to a physical model.
    2. Unfortunately, the lines will not remain in the same position if you move the tables. If you are synching the physical model from the database one way to minimise the disruption to the lines would be to update the objects in the application navigator. This will update the existing objects in your diagram when you open the diagram - but it should not reposition the tables already on the diagram too much. then you can add any new tables to the diagram and you will have to position them.
    3. Use the Note drawing component to add text and labels and use the Group to group elements (both of these are found in Diagram Annotations (an accordion in the Component Palette). These are here because our database diagrammer is also based on UML diagram framework
    4. I am not aware of any problems with the .svg format. But I would suggest trying the latest release of JDeveloper to see if any problems you encountered a year ago are now gone. Please let me know if you still experience problems
    5. In the latest release you will also find new reporting facilities for database models. New - Offline database - reports and prebuilt-reports will allow you to report using a SQL interface on your elements and produce HTML documents of these
    Generally, we have made great progress on database modeling in the last couple of releases.
    rgds
    Susan
    susanduncan.blogspot.com

  • Keen for suggestions on a JMS impl that meets these requirements...

    Hi All
    We have hit some glitches with a set of geophysical migration jobs we are doing on a server cluster. I have been asked to distribute some of the work amongst several servers in the cluster (the current distribution mechanism is not working out) and need some mechanism for messaging between the jobs.
    The guys here are quite keen to get something up quickly for the moment and I have suggested we might be able to use a lightweight JMS implementation for starters.
    Could anyone suggest one that meets the following criteria?
    - Reliable
    - Fast
    - Easy learning curve (as we are on a tight deadline).
    - Supports guaranteed delivery
    - Easy to develop with (ie junit friendly)
    - OpenSource
    - Works on linux
    We can make the following concessions...
    - Point to point only required at the moment
    - No need for fancy configuration front ends
    - No immediate scaling requirements.
    Thanks

    I'm completely biased, but ActiveMQ seems to fit the bill perfectly
    http://activemq.org
    James
    http://logicblaze.com/
    Open Source SOA

  • Extracting rows that match a certain criterion

    Hi guys,
    I realize that spreadsheet software has certain limitations, but I was hoping I could stretch it a tad bit, by asking if it's possible to take rows that meet a certain criterion and have them listed in another table.
    I've included an example wherein I take a list of a few well-known crypto characters and extract those that are not checked as evil (i.e., evil is FALSE) into a different list.
    http://pyth.net/hotlinking/cast-salaries.png
    I'd appreciate any suggestions; and thanks in advance for any time taken to respond.
    Regards,
    Friðrik Már

    We have posted a solution but now I have to find it. You can test for the "TRUE" / "FALSE" nature of the check box then show related row/column information using VLOOKUP, and IF statements. You could then filter for the presence of a value.
    =IF(A2=TRUE,VLOOKUP(...
    Regards,

  • Need help with query that can look data back please help.

    hi guys i have a table like such
    CREATE TABLE "FGL"
        "FGL_GRNT_CODE" VARCHAR2(60),
        "FGL_FUND_CODE" VARCHAR2(60),
        "FGL_ACCT_CODE" VARCHAR2(60),
        "FGL_ORGN_CODE" VARCHAR2(60),
        "FGL_PROG_CODE" VARCHAR2(60),
        "FGL_GRNT_YEAR" VARCHAR2(60),
        "FGL_PERIOD"    VARCHAR2(60),
        "FGL_BUDGET"    VARCHAR2(60)
      )and i have a data like such
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
    fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
    so im trying to write a query that basically does the following.
    im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
    so the expected outcome should be $700
    240055     240055     7240     4730     02     10     14     200
    240055     240055     7600     4730     02     10     14     100
    240055     240055     7600     4730     02     11     1     400keep in mind that im not given a year just a period.
    any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
    finally broke down and put together this post
    Edited by: mlov83 on Sep 14, 2011 8:48 PM

    Frank
    wondering if you can help me modify this sql statement that you provided me with .
    table values have been modified a bit.
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
    the current period +(current period - greatest year 00)
    hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
    because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
    period 2 amount $ 600
    period 0 amount $ 400 - period 2 amount of $600 = 200
    600+200 = $800
    if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
    i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
    can you please help me out.
    Miguel

  • Creating a query that provides a default transaction type for those transactions not categorized?

    How could I create a query that provides a default transaction type for those transactions not categorized?
    So assuming I have:
    * Transactions table (with transactions)
    * Categories table
    * transactions_categories table - allows to allocate multiple categories (with a percentage)
     - tranactionID
     - categoryID
     - percentageAllocation
    * Usage is such that only non-personal categories have been applied through out data.  So there is a lot of transactions with no categories applied
    Aim:
    * Want to create a query that creates a list of all the allocated amounts, so would include as columns:  transaction.tDate, transaction.tTitle, categories.name, allocatedAmount(calculated from percentage * transaction amount)
    BUT:
    * How could I include in the query, the entries that cover all transaction that haven't been allocated, to a default category "personal", where the allocated Amount would be 100% of the transaction value
    * And also (if it were possible), for transactions that have been categorized but not for the complete transaction value (say only 50% was allocated to a category), how to to cover this off to.  

    To default the value of the category:
    select IIf(IsNull(Category),"Personal",Category) as Category,IIf(IsNull(Category),"100%",PercentageAllocation
    ) as PercentageAllocation from [yourtable]
    What do you want to put the values of these ones:
    And also (if it were possible), for transactions that have been categorized but not for the complete transaction
    value (say only 50% was allocated to a category), how to to cover this off to.  
    Fouad Roumieh

  • Query That Retrieves New Customers & Leads By Date

    Hello All --
    We would like to create a Query that retrieves new customers and leads based on the date (or date range) they are entered into SAP. 
    Can we create a UDF named STDATE --- Start Date -- and have a Query that allows us to select based on this date range?
    Start dates are entered in this format --- YYYYMMDD.
    Then, the Query would pull out:
    Contact...Company...Bill To Address...Bill To City...Bill To State....Bill To Zip...Phone...Email
    Is this possible to do?
    Thanks!
    Mike

    Hi Mike ,
    You can add some other field as you like .This report will give you combination of both customer and lead .
    I couldn't understand the purpose ,but I like previous query as i have flexibilty to choose customer or vendor .
    SELECT T0.[CreateDate], T0.[CntctPrsn], T0.[CardName], T0.[Address], T0.[City], T0.[E_Mail], T0.[ZipCode], T0.[Phone1] FROM OCRD T0 WHERE T0.[CardType] in ('C','L') and T0.[CreateDate]=[%0]
    If you agree with me ,you can use this query
    SELECT T0.[CreateDate], T0.[CntctPrsn], T0.[CardName], T0.[Address], T0.[City], T0.[E_Mail], T0.[ZipCode], T0.[Phone1] FROM OCRD T0 WHERE T0.[CardType] =[%0] or T0.[Cardtype]=[%1] and
    T0.[CreateDate]=[%2]
    Regarding the date issue , since you are entering paramenter it will match with the date you are looking for .If you have more than one customer created on same day , you willreceive multiple client .
    Thank you
    Bishal

  • Problem with select query that includes a date

    I've been fighting with this for about 4 hours - yes, quite literally... I've never been good with date stuff. I have a brain block.
    Anyway, here's the situation:
    I have an Access database that has a time/date field. There are no times, just a date in mm/dd/yyyy format.
    That table is a list of classes held for the past three years. I want to make a query that only shows the classes that have ended after January 1 of this year. I don't want to put 01/01/2010 in the query itself because I want it to still work next year.
    This is the current query:
    <cfquery name="classes" datasource="#DSN#" dbtype="ODBC">
    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit
    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime ON classes.classTime = classTime.timeID) INNER JOIN owners ON classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType
    WHERE  classes.classEnd <  01/01/#DatePart("yyyy", now())#
    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle
    </cfquery>
    I don't get any results, but I should get a list of every class that has an end date before January 1 of this year - about 200 records.
    When I swap around the where clause to:
    <cfquery name="classes" datasource="#DSN#" dbtype="ODBC">
    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit
    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime ON classes.classTime = classTime.timeID) INNER JOIN owners ON classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType
    WHERE  classes.classEnd > 01/01/#DatePart("yyyy", now())#
    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle
    </cfquery>
    I get EVERY class in the database, and I should only be getting about 50
    The classes are about 8 weeks long, the begin date and end date are in the database as date/time fields, so I need to show everything that ended in 2010, regardless of when it started.
    I'm sure it's something glaringly obvious, but it's escaping me.
    THANKS
    Michelle

    The format of your date field in access is irrelevent to the situation at hand.  Use proper date objects instead of trying to build a suitable string.  For the first of January of the current year, the coldfusion functions createdate(), year(), and now() are your freinds.  Then, in case Adam's post was not clear, use cfqueryparam with the resulting variable.

  • OTL I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?

    Hi
    I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?
    I basically need person name who submitted, date - time it was submitted for approval, then the person who approved it and the date - time that it was approved
    Thanks
    Ruby

    Ruby,
    you can start with HXC_TIMECARD_SUMMARY table for submitter detail. But for approver details, i think you need WF tables to get the data for item type HXCEMP.

  • Need a Query that Returns both Column Name with Column Data

    Hi,
    Hope someone can assist quite quickly. I'm after a query that will return me both column name together with column data, i.e
    Table: APP_INFO
    COL1  - currently has the value of 10
    COL2  - currently has the value of 'HELLO'
    COL3  - currently has the value of 'QWERTY'
    COL4  - currently has the value of 2000Query I'm after is to return the following result set: [actual column name, actual column data]
    COL1,10
    COL2,'HELLO',
    COL3,'QWERTY'
    COL4,2000
    Any help would be much appreciated.
    Thanks.
    Tony.

    Like this ?
    SQL> select empno, ename, deptno from emp where deptno = 10;
         EMPNO ENAME          DEPTNO
          7782 CLARK              10
          7839 KING               10
          7934 MILLER             10
    SQL> select decode(t.id,1,'EMPNO',2,'ENAME',3,'DEPTNO') COLNAME,
      2  decode(t.id,1,to_char(empno),2,ename,3,deptno)
      3  from (select emp.*, rownum rn from emp
      4  where deptno = 10) emp, (select rownum id from dict where rownum <=3) t
      5  order by emp.rn, t.id
      6  /
    COLNAM DECODE(T.ID,1,TO_CHAR(EMPNO),2,ENAME,3,D
    EMPNO  7782
    ENAME  CLARK
    DEPTNO 10
    EMPNO  7839
    ENAME  KING
    DEPTNO 10
    EMPNO  7934
    ENAME  MILLER
    DEPTNO 10
    9 rows selected.Rgds.

  • Query that show total discount on A/R Invoice

    Dear all,
    I would like to have query that show summary of each invoice number that show 'Total of discount'  ( 'Total of discount' = total of discount in line item + discount of total invoice ). Data that I would like to show on this query is as follow :
    Invoice No, Invoice Date, Customer Code, Total before discount, 'Total of discount',  Total Amount, Vat amount
    Please kindly suggest the way to get this data.
    Thanks you in advanced.
    Angnam

    Hi Angnam K,
    Try This one...hope this will serve your purpose.
    SELECT  DocEntry, DocNum,   CardCode, CardName, DocDate, [Total Before Discount] , [Totaldiscount]+  [OinvDiscount] as [Total of discount], VatSum [Total Tax]      FROM (
    SELECT T0.DocEntry,T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], SUM(T1.[LineTotal])[Total Before Discount],
    SUM(T1.[PriceBefDi] * T1.Quantity *T1.[DiscPrcnt])/100 as [Totaldiscount]
    ,Case When T0.[DiscPrcnt] <> 0 Then  (SUM(T1.[LineTotal])/ T0.[DiscPrcnt]) Else 0 end [OinvDiscount] ,T0.VatSum
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    Group By T0.DocEntry,T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DiscSum] ,T0.[DiscPrcnt],T0.VatSum )Sales
    thanks,
    Kumar
    Edited by: itskumaramit on Jul 13, 2011 12:43 PM

  • Internal query that is used during the message search from EMC

    Hi,
    We have a requirement where in we need to identify the internal query that is executed ( since there were few mails that are being deleted at production instance, so want to know the details) when we search for the data from the following navigation:
    Oracle Email Center -> Messages -> Search.
    Could you please help us out in knowing the exact query as early as possible as it is of high priority.

    Thanks for your input.
    Let me explain how we solved our problem in brief:
    - We have created a new infobject for item number with 5 digits
    - We added this to the key in DEV system
    - We created a copy of the active table how it would look like after transport on DB level
    - We copied data 380 million records into the new table on DB level
    - We renmade the active table to xxx_old to have a back-up and then re-created an empty active table via SE14
    - We imported the transport when all 3 DSO tables were empty, which was very fast
    - We dropped the empty active table
    - We renamed the copy of the active table to carry the name of the active table
    During this process we ensured beforehand that SIDs are available for the new IOBJ. We also filled the new IOBJ by copying the values from the 3-digit IOBJ.
    All went well.

Maybe you are looking for

  • Up to 8gig memory supported on T400????

    Can the t400 support this much memory?  I think lenovo says that it does

  • JSF Page -- Backing Bean -- Non-JSF Page ...

    Hi I have a JSF page where the user enters data and submits by clicking on the Submit button. My backing bean then takes the data and processes it. After successful processing, I want to direct the user to a non-JSF page. What is the best way of achi

  • Move Contribute CS4 from a Windows 7 computer to a Windows 8 computer

    Is there a way to do this and save the key settings from the Windows 7 installation so I don't have to enter a connection key in Windows 8?

  • Regarding Data Base Select Query

    Hi All,           I want to extract the data from data base into my internal table           by not giving the exact value but the pattern.           Ex) I want to select the vendor starting with patter '12*'                 from LFA table in my inte

  • Xmltable in plsql

    I am trying to get data which is in an xmltype table for use in my plsql procedure and keep getting err: Error(19,41): PLS-00302: component 'OBJECT_VALUE' must be declared Am I approaching this wrong? It works fine without the into in SQL. Thanks dec