Results 1 to 6 of 6
  1. #1
    GrindEspresso is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    3

    Help with complex query (for me at least)

    Hi, I have a query I'm trying to put together but I'm having difficulty. The results I'm trying to achieve are as follows:



    Code:
     
    Product, Type, Size, In Stock, At Factory, At Store
    Slate, R, 1.7x91x190, 121, 44, 3
    Slate, R, 1.7x89x210, 0, 1, 1
    Marble, M, 2.2x100x100, 12,25,1
    Size comes from three columns Thickness, Width and Length so the size above is concatenated together for display. The count fields (stock/factory/store) come from counting the rows for each thickness that has those widths and lengths.

    I need to group the thickness/width/length count them and display them distinct. Any help would be much appreciated.

    Thanks (sorry about the formatting)

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    first, you'd better store the size in 3 seperate fields: width,length,height. then you can get what you need easily

  3. #3
    GrindEspresso is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    3
    If your referring to the table from which the data is coming, they are stored seperately. thickness, width, length.

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    then you can use query to group by thickness,width,or length.

  5. #5
    GrindEspresso is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    3
    I have gotten this query so far but its not producing the results I want.

    SELECT [Product], [Type], [thickness] & "x" & [Width] & "x" & [Length] AS [Size], [thickness], [width], [length], Count(thickness) AS [At Store],
    FROM [Packing List]
    GROUP BY [Product], [Type], [thickness], [width], [length], [Date]
    HAVING ((([Date]) Between #8/20/2010# And #11/20/2010#));

    I have tried this using SELECT DISTINCT and if I remove the count then I get one row for each thickness so how do I incorporate the count in the query and still only have one row for each thickness?

    Any help appreciated

    Regards

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    you can't put thickness, width and length together, you need to write different queries for thickness, length and width.

    for example, for thickness:
    SELECT [Product], [Type], [thickness],Count(thickness) AS [At Store], FROM [Packing List] GROUP BY [Product], [Type], [thickness]
    HAVING ((([Date]) Between #8/20/2010# And #11/20/2010#));

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Duplicate query with complex delete function
    By rushforth in forum Queries
    Replies: 9
    Last Post: 08-20-2010, 01:21 AM
  2. Complex query system for map database
    By brian.tunks in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 07:07 AM
  3. need help, expression is too complex?
    By ice673 in forum Queries
    Replies: 5
    Last Post: 02-15-2010, 09:03 PM
  4. Complex Query/Queries for a Report
    By Rawb in forum Queries
    Replies: 3
    Last Post: 02-04-2010, 07:44 AM
  5. Complex Update query
    By niihla10 in forum Queries
    Replies: 1
    Last Post: 08-28-2009, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums