Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22

    ok thanks for helping!

  2. #17
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    it worked but i have one little problem, if the phone doesnt have any sales it just dont show up instead of typing 0 (i changed NULL to 0) how do i fix this? if there is a way

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    What you want would be fairly simple if PhoneTypes was one table instead of 2 as was suggested in your other thread. As is, gets complicated.

    Query1: AllPhones
    SELECT [Phone ID 32GB] AS PhoneID, "32GB" AS Type, [Inventory 32 GB] AS Inventory FROM [Phone Types - 32GB]
    UNION SELECT [Phone ID 64GB], "64GB", [Inventory 64 GB] FROM [Phone Types - 64GB];

    Query2
    SELECT AllPhones.PhoneID, AllPhones.Type, Nz(Sum(IIf([Phone Type]="32GB",1,Null)),0) AS Count32, Nz(Sum(IIf([Phone Type]="64GB",1,Null)),0) AS Count64
    FROM Sales RIGHT JOIN AllPhones ON (Sales.[Phone ID] = AllPhones.PhoneID) AND (Sales.[Phone Type] = AllPhones.Type)
    GROUP BY AllPhones.PhoneID, AllPhones.Type;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    wait so the second query should look like this? https://imgur.com/a/mGfoJM2 why is it seperated? and suppost to replace the first query you send me?
    also can you explane to me if i changed the phone id in my query to get it [Phone Common Things] table instead of [Sales] sales, shouldnt is show all the phones? instead of removing all the phones

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Yes, that is result of query 2. Yes, these replace first suggested query because you expanded the requirement.

    Why is what separated?

    I am not sure what you mean by 'removing all the phones'. The output shows a record for each phone type.

    If this is not the output you want, then provide a mockup of what you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #21
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    Quote Originally Posted by June7 View Post
    Yes, that is result of query 2. Yes, these replace first suggested query because you expanded the requirement.

    Why is what separated?

    I am not sure what you mean by 'removing all the phones'. The output shows a record for each phone type.

    If this is not the output you want, then provide a mockup of what you want.
    sorry for the previews message xD for not being clear

    when I said separated in the 2 query there is 2 records per phone Id

    when I said removing all phones I didn't complete the sentence and I meant that its removing all the phones from the query result

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    There are 2 records per phone ID because you have 2 tables for phone types. Try removing AllPhones.Type field from second query and see if that gets you desired result. Simply open in DesignView and delete field from the grid. If still not correct, provide mockup. I still don't know what 'removing all the phones' means.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    Quote Originally Posted by June7 View Post
    There are 2 records per phone ID because you have 2 tables for phone types. Try removing AllPhones.Type field from second query and see if that gets you desired result. Simply open in DesignView and delete field from the grid. If still not correct, provide mockup. I still don't know what 'removing all the phones' means.
    lets say i have 10 phones and only 9 sold why is it showing only the 9 and not all the phones with the 10th phone sales being 0,0?
    so instead of https://imgur.com/nJ8De4T it will be https://imgur.com/Jc57QHZ.

    i tried using the querys you sent me in my Finished table and it look like this http://prntscr.com/o4gq2y and all the value are simillar for all phones even if they dont have sales
    but when i create a calc total query it didnt do that after grouping up the results http://prntscr.com/o4gy6b ,any idea what can cuase that to happen in the Finish table?
    do you think its possible to solve?

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    I am using db you posted. Queries I suggested result in a dataset like first image with additional row for PhoneID 43 showing 0 in both columns. I don't know why you get variation from what I provided because you are not providing your queries for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #25
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    Phone Shop - Copy.zip here is my project

  11. #26
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Sorry, wrong thread.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #27
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    can you send me the access project that you did which shows phoneID 43 as 0,0? please so see what is the difference between them

  13. #28
    GetRektByNoob is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2019
    Posts
    22
    nvm fixed the problem by changing the relashan ships in the query tnx for helping!

  14. #29
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    All you have to do is modify query [June7 - Second SQL] as suggested in post 22 and you will get same output I get.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-15-2019, 11:50 AM
  2. Replies: 6
    Last Post: 06-20-2017, 08:56 AM
  3. Replies: 2
    Last Post: 06-30-2016, 06:38 PM
  4. Replies: 2
    Last Post: 04-15-2014, 01:59 PM
  5. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 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