Query Problem- trying to group by Item Group

Hi All
I am creating a report which details the Item code, Item Description, In stock amount, Commited amount and the Price one particular price list.  I want this to be grouped by the Item Group.  The query below is the one I have created.  It works well until i add anything into the Group by section. 
SELECT T1.[ItemCode],
T1.[ItemName],
T2.[OnHand],
T2.[IsCommited],
T0.[Price]
FROM ITM1 T0  INNER JOIN
OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod
INNER JOIN OPLN T4 ON T0.PriceList = T4.ListNum
WHERE T4.[ListName] = 'Selling Prices GBP'
GROUP BY T3.[ItmsGrpNam]
I receive the following error when exectued:
Column 'OITM.ItemCode' is invalid in the select list because it is not contained in either an aggregate function or the GOUP BY clause
Can anyone help?
Thanks in advance
Gail
Edited by: Gail Patterson on Apr 3, 2008 1:32 PM

Hi,
Can u use this query
SELECT T3.ItmsGrpNam, T1.ItemCode, T1.ItemName, T2.OnHand, T2.IsCommited, T4.ListName, T0.Price
FROM ITM1 T0 INNER JOIN
OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod
INNER JOIN OPLN T4 ON T0.PriceList = T4.ListNum
WHERE T4.ListName = 'Selling Prices GBP'
It can help u.
Thanks
SAGAR

Similar Messages

  • PLD - How to link Items and Items Group

    Hi guys, I'm having a problem that seems simple, but I can't solve it.
    My sales order layout was working fine, showing items and grouping by items group. Then all of a sudden, it started not to show anything in the repetitive area.
    When I was studying the problem I realized that when I add anything from the Items table (OITM) it doesn't list any results.
    I suppose PLD should link RDR1.ItemCode with OITM.ItemCode automatically, no?
    Is there anything I can try?
    Thanks!!
    Dan

    Hi Dan,
    Your assumption is not true.  RDR1 is not linked to OITM after created.  If you need anything from OITM table, it can only through UDF in Marketing Document Row.
    Thanks,
    Gordon

  • How to find empty item groups?

    hi Experts,
    Can anyone help me with writing query which will show me which item groups do not contain any items or are not in use?
    Regards
    Jon

    Hi Geoff,
    Both queries will work for you and return the same records.
    The top one executes slightly quicker as the WHERE clause for each item group isn't looking through the list of items each time, but if you don't have too many items or item groups it shouldn't make any difference.
    Regards,
    Adrian

  • Commissions by Item Group

    Does anyone know a way to set commissions by item group, for a specific sales person? In other words, one sales person gets a percentage commission based on a specific item group. Item Group A is 10% for Saleman C, Item Group B is 5% for Salesman C, for example. Only way i have so far is a formatted search, but would prefer to do in B1 without special coding.
    Thanks

    I think this is a question better suited to the B1 Core forum - I think us developers are only going to suggest special coding

  • Difference - set g/l account by warehouse,item group,item level

    hi all,
    Pl. explain what is difference between setting
    g/l accounts by warehouse,item group,item level ?
    Jeyakanthan

    Hi Jeyakanthan,
    Let us consider an example that will make you understand this better. Consider that you are creating GRN's for Item A and Item B. The accounts that get updated are :
    1. Inventory Account/Stock account: gets debited
    2. Goods Received Not Invoiced Account : Gets Credited.
    Now let us consider that Item A has been grouped under the item Group Raw Materials and Item B has been grouped under Item group Finished Goods. Now as mentioned above if you choose the Set G/L accounts by as Item Group in the Accounting tab of the item Group Raw Materials you will have to choose the Inventory/Stock Account as Inventory -  Raw Material and for the Item Group Finished Goods the Inventory/Stock account has to be Inventory- Finished Goods. In all cases the Goods Received not Invoicved account will remain the same.When you create the GRN's the respective Inventory accounts will get debited and when you create the A/P Invoice for these the Goods Received Not Invoiced account will get Debited and the Vendor account will get credited.
    Now in case if your company manages goods according to the Warehouse i.e. if the company has different warehouses for different types of goods like Raw Material warehouse for Raw Materials , Finished Goods warehouse for Finished goods then you should set the G/L accounts by Warehouse so that in the item master in the inventory Tab the respective warehouse is chosen and the relevant accounts are updated. Just for example when you choose Set G/L accounts by Warehouse for item A then  in the accounting tab of the Raw Material Warehouse choose Inventoty  - Raw material.
    In the 3rd case consider that you are buying a Machine to be used in your workshop which is costing  you around Rs. 10,00,000/- and the management wants to know the monthly utilisation costing of the machine like power, labour charges and overheads for that particular machine then it is better to define G/L accounts based on that item i.e. if Item C is a machine for which the Management wants to know the costing details then it would be better off defining a G/L account as Inventory - Item C. This option is better to be used for capital goods or Fixed assets.
    For better understanding in the item master you need to initialise thru the Form settings the various G/L accounts like Goods received Not Invoiced accounts, Inventory accounts , Allocation Cost account etc.
    Hope this calrifies matters.
    Nagesh.

  • Stock Item Group problem

    I came accross a problem as follows:
    1. An Item Group called "SAMPLES" is set to Default Valuation Method to FIFO
    2 A Stock Item called Hand Cream Sample is set to GROUP = Samples
    3. I expected the Hand Cream Sample item to show FIFO under the Stock Data tab in the Item Master however it shows Moving Average valuation method.
    Most of my Items show correctly the valuation method set in Item Groups but I have a few that do not follow this pattern. Any ideas how to correct this and why is this showing incorrectly?
    Thanks
    PS I use B1 2007version
    Robert

    Hi Istvan
    I think you are right and there may be a problem here which I am trying to understand. The issue is as follows:
    1. There are 3 places where you can set Default Valuation method
    a. System Init/Company Details/Item Group Valuation method
    b. In System/Setup/Stock Management/ Item Groups
    c. In Item Master Data
    It seem to me that b overwrites the a setting and, c ovewrites a and b
    In other words one can set in Item Master Data different valuation method to any Defaults set in a or b. This does not sound quite correct to me since on should value stock consistently at whatever the Company policy may be.
    The question is that once you have movement on a stock item and you want to change the valuation method, it cannot be changed (forever?). We would like to have ALL items valued at FIFO and now we have a mixture because we did not understand SAP b1
    What do you think is the right solution to this issue
    Your input is much valued on this topic
    Thanks
    Robert
    PS To confuse matters ever further, I have a Stock Item that has movements (Invoice In) but it allows me to change the valuation method in the Stock Data tab. In all other items this option is grayed out.

  • Is it possible to list out CATALOG ITEMS GROUP in a Query Result of a Request Offering??

    Hi Experts,
    Is it possible to list out  CATALOG ITEMS GROUP as a result of Query Result in Request Offering ?? Because each and every Catalog Items Groups are being created as a SingleTon Child Class of System.CatalogItemGroup. i.e., Each CatalogItemGroup instance
    will have its own singleton class.
    Is it possible to list out all CatalogItemGroup Instances consolidatedly in the QueryResult Window??
    Though the System.CatalogItemGroup class is an Abstract class, I tried to list out the Classinstances via powershell command as below, which lists all catalog group instances, Note: Actually these are instances of SingleTon
    Child Classes
    "Get-SCClassInstance -Class (Get-SCClass -Name System.CatalogItemGroup)"
    But when I configured the QueryResult window with the "System.CatalogItemGroup" class, it doesn't list out any Group instances in the Porta.......
    Am I missing anything, Any suggestions please???
    Thanks and Regards, Narayana Babu

    Thanks Anton, I already tried that too... But it doesn't list out any Group instances in the Portal.
    Since each Catalog Groups are individual Single ton Class instances derived from "System.CatalogItemGroup" class. Therfore If I specify the internal ID of the abstract class "System.CatalogItemGroup" in the tag below, it doesn't list any in the
    Portal.... But if I specify ID of any one of the derived singleton class, it does displays the one instance of that particular class..
    Thanks and Regards, Narayana Babu

  • Hi I do not want iTunes to open up automatically when I turn on my macbook pro.  I tried going to System Preferences Users and Groups Login Items and then I took iTunes off the list but it still opens up automatically when I turn on my laptop.

    Hi I do not want iTunes to open up automatically when I turn on my macbook pro.  I tried going to System Preferences>Users and Groups>Login Items and then I took iTunes off the list but it still opens up automatically when I turn on my laptop. What should I do?

    Hi r,
    Make sure you close iTunes before shutdown.  And you're quite welcome.

  • I am trying to stop programs from opening automatically when I turn my computer on.  I tried system preferences users and groups login items...then I deleted them from the list but it did nothing.

    I am trying to stop programs from opening automatically when I turn my computer on.  I tried system preferences>users and groups>login items...then I deleted them itunes and emial from the list but it did nothing.  They continue to open up every time I turn on my Macbook Pro.

    Hi r,
    It sounds like you're running Lion?
    Have you tried running Verify and/or Repair Disk?
    Have you tried running Repair Permissions?
    Do you have at least 15% free space available on your HD?

  • Sales Analysis query per item group summarized per BP Group

    Dear experts,
    My client is requiring me to create a query that when i select a certain item group it returns a sum/total of sold items in that group per BP group
    format:
    parameter: Item Group A
    BP Group A    1,000
    BP Group B    2,000
    BP Group C   1,000
    I have managed to get total sales per BP Group but i cant seem to figure how to break it down per Item Group
    here is my query:
    SELECT T2.[GroupCode], SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) as "Amount(LC)" FROM JDT1 T0  INNER JOIN OJDT T1 ON T0.TransId = T1.TransId and T0.TransType IN (13,14)
    INNER JOIN OCRD T2 ON T2.CardCode = T0.ShortName
    WHERE T1.[RefDate]  BETWEEN [%0] and [%1]
    GROUP BY T2.[GroupCode]
    how can I link Item Groups to JDT1?

    Hi Carlo
    Try This
    SELECT t5.ItmsGrpNam AS ItemGroup,
       t7.GroupName AS BPGroup,
       SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) AS "Amount(LC)"
    FROM JDT1 T0
    INNER  JOIN OINV T1 ON T0.transid = T1.transid
    LEFT OUTER JOIN INV1 T3 ON T1.docentry = T3.docentry
    LEFT OUTER JOIN oitm T4 ON t4.itemcode = T3.itemcode
    LEFT OUTER JOIN oitb T5 ON T4.ItmsGrpCod = T5.ItmsGrpCod
    INNER  JOIN ocrd T6 ON T0.ShortName = T6.CardCode
    INNER JOIN OCRG T7 ON t7.GroupCode=t6.GroupCode
    WHERE T1.DocDate BETWEEN [%0] AND [%1]
    GROUP BY t5.ItmsGrpNam,
       t7.GroupName
    Rgds

  • Item groups query

    Hi all experts.
    I'm wondering if anyone could be so kind to help me with a query.
    I would very much like to se total sales amount (based on OINV) for each item group in my database. I'm fully able to get some figures by doing this query:
    SELECT distinct T0.[DocNum], T3.[ItmsGrpNam], T0.[DocTotal]
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod
    WHERE T0.[DocDate] >=[%0]
    GROUP BY T0.[DocNum], T3.[ItmsGrpNam], T0.[DocTotal]
    ORDER BY T3.[ItmsGrpNam]
    However, in this query I'm missing totals for each grup - is this possible to achieve?
    Thanks and regards, Runar Wigestrand
    Edited by: Runar Wigestrand on Nov 3, 2008 11:15 AM

    hi runar,
    SELECT T3.[ItmsGrpNam],Sum(T0.[DocTotal] )
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod
    WHERE T0.[DocDate] >= '[%0] '
    GROUP BY T3.[ItmsGrpNam],T0.[DocTotal]
    ORDER BY T3.[ItmsGrpNam]
    Jeyakanthan

  • Problem trying to upbate ituns error masage the older version of apple software update  cannot be removed  contact your nearest spport group

    problem trying to update iTunes error massage the older version of apple software update  cannot be removed  contact your nearest support group how
    can i fix this problem i have tried many things but it still dose not work for me ????

    Download the Windows Installer CleanUp utility from the following page (use one of the links under the thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any Apple Software Update entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Query to generate a report for incoming pending payments as per Item Group!

    Dear All,
    I need a Query to generate a report for incoming pending payments through Item Group.
    Please provide me the same.
    Thanks in advance..........................
    Edited by: Param Deshwal on Nov 22, 2011 7:11 AM

    Hi
         try this
    SELECT T0.[DocNum] as 'Invoice Number', T0.[DocDate] as 'Invoice Date', T0.[CardName], T0.[DocTotal] as 'Invoice Amount', T0.[PaidToDate] as 'Paid Amount',(T0.[DocTotal]-T0.[PaidToDate]) as 'Pending Amount',T3.[ItmsGrpnam] FROM OINV T0 Inner join inv1 t1 on t0.docentry=t1.docentry inner join oitm t2 on t2.itemcode=t1.itemcode inner join oitb t3 on t3.[ItmsGrpcod]=t2.[ItmsGrpcod] where T3.[ItmsGrpnam]=[%0] 
    Regards,
    sudhir B.
    Edited by: B.sudhir on Nov 22, 2011 7:28 AM

  • Query - Grouping by Item

    Am trying to have same items on a particular day be grouped under one total but even after adding sum it is giving me same items of the same day separate...
    SELECT T0.[PostDate],T0.[DocNum],T1.[ItemCode], T1.[ItemName], sum(T0.[PlannedQty]) as 'Planned Qty', sum(T0.[CmpltQty]) 'Comp Qty' FROM OWOR T0 inner join OITM T1 on T1.[ItemCode] =T0.[ItemCode] WHERE T0.[PostDate] >=[%0] and T0.[PostDate] <=[%1] and T1.[ItmsGrpCod] in (104,106,107,108,113,116,120) GROUP BY T0.[PostDate], T1.[ItemCode], T1.[ItemName], T0.[PlannedQty], T0.[CmpltQty],T0.[DocNum]

    Try to leave out the docnum if you want only the sums:
    SELECT T0.PostDate,T1.ItemCode, T1.ItemName,
    sum(T0.PlannedQty) as 'Planned Qty', sum(T0.CmpltQty) 'Comp Qty'
    FROM OWOR T0 inner join OITM T1 on T1.ItemCode =T0.ItemCode
    WHERE T0.PostDate >=[%0] and T0.PostDate <=[%1] and T1.ItmsGrpCod in (104,106,107,108,113,116,120)
    GROUP BY T0.PostDate, T1.ItemCode, T1.ItemName, T0.PlannedQty, T0.CmpltQty

  • Nested Group Function without Group By Problem

    Hey everyone,
    I have 3 tables as below:
    TABLES
    ITEM (Item_no, Item_price, desc)
    DeliveryItem (delivery_no, item_no, quantity)
    Delivery (delivery_no, delivery_date)
    SELECT desc, MAX(SUM(quantity)) FROM DeliveryItem, Item, Delivery WHERE Item.item_no = DeliveryItem.item_no AND Delivery.delivery_no = deliveryitem.delivery_no;
    And I'm trying to output description of most delivered item but I got an error like SQL Error: ORA-00978: nested group function without GROUP BY. Could you help me to fix my code?
    Thanx

    Hi,
    DESC is not a good column name; you could get errors if the parser thinks it means DESCending. I used DESCRIPTION instead, below.
    I think the best way is to do the SUM in a sub-query, lkike this:
    WITH     got_r_num     AS
         SELECT       item_no
         ,       SUM (quantity)     AS total_quantity
         ,       RANK () OVER (ORDER BY  SUM (quantity) DESC)     AS r_num
         FROM       deliveryitem
         GROUP BY  item_no
    SELECT     i.description
    ,     r.total_quantity
    FROM     got_r_num     r
    JOIN     item          i     ON     r.item_no     = i.item_no
    WHERE     r.r_num     = 1
    ;If you want to do it without a sub-query:
    SELECT       MIN (i.description) KEEP (DENSE_RANK LAST ORDER BY SUM (di.quantity)
                        AS description
    ,       MAX (SUM (quantity))     AS total_quantity
    FROM       deliveryitem     di
    JOIN       item          i     ON     d1.item_no     = i.tiem_no
    GROUP BY  i.description
    ;If you do nested aggegate functions, then every column in the SELECT clause must be an aggregate applied to either
    (a) another aggregate, or
    (b) one of the GROUP BY expressions.
    That's why you got the ORA-00937 error.
    This second approach will only display one row of output, so If there is a tie for the item with the greatest total_quantity, only one description will be shown. The RANK method will show all items that had the highest total_quantity.
    It looks like the delivery table plays no role in this problem, but it there's some reason for including it, you can join it tpo either query above.
    Of course, unless you post test copies of your tables (CREATE TABLE and INSERT statements) I cn't test anything.
    Edited by: Frank Kulash on Nov 6, 2010 10:57 AM

Maybe you are looking for