Results 1 to 9 of 9
  1. #1
    swt027 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Location
    California
    Posts
    6

    Query Where Code

    Show all the patient states that end in the letter“I” (capital i).
    How do I isolate "I"


    Where P_state like ??

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    SELECT [the field you want to show] FROM [your table or query] WHERE [the field you're searching] LIKE "*I"

  3. #3
    swt027 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Location
    California
    Posts
    6
    Thank you! Can I ask you another question on here or do I have to start a new thread?

  4. #4
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    i dunno... go for it!

  5. #5
    swt027 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Location
    California
    Posts
    6
    Calculatethe average balance for all patients of each therapist

    Patient_Number P_LastName P_FirstName P_Address P_City P_State P_ZipCode P_Balance P_Insurance TherapNumber
    AL26 Alardyce Lisa 311 Birchwood Lamont MI 49160 $196.62 $180.00 05
    BR31 Bryce Roger 617 College Lamont Mi 49160 $96.00 $0.00 08
    DI32 Dalton Irene 41 Lafayette Madison IN 42909 $875.00 $600.00 14
    GC92 Gutierez Carlos 476 Fulton Jakson OH 49401 $273.00 $150.00 05
    GT43 Grant Thomas 247 Fuller Lamont MI 49160 $276.00 $0.00 08
    JG22 Jenkins Glen 201 Plymouth Madison IN 42909 $0.00 $0.00 08
    LI66 Lawrence Irving 912 Devonshire Beulah MI 45621 $346.50 $175.00 05
    PE33 Pezato Eduardo 346 Vernor Homer MI 49162 $467.12 $500.00 14
    PE76 Perez Enzo 216 Four Mile Perry MI 47211 $216.00 $0.00 08
    T73 Acton Thomas 312 Newcastle Homer MI 49162 $726.42 $550.00 08

    SELECT Therapnumber
    FROM Patient_Table;
    Having avg(P_balance)

    This didn't work

  6. #6
    swt027 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Location
    California
    Posts
    6

    Query where Code

    Figured it out
    SELECTavg(P_balance) as NewPtBaln, Therapnumber
    FROM Patient_Table
    Group by Therapnumber

  7. #7
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    You want an aggregate query

    SELECT Patient_Number, P_LastName, TherapNumber, Avg(P_Balance) AS AvgBalance
    FROM Patient_Table
    GROUP BY Patient_Number, P_LastName, TherapNumber;

    But it will be alot easier to build your query in the query designer. https://www.youtube.com/watch?v=CgBcI8rq10k

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,402
    SELECT Patient_Table.TherapNumber, Avg(Patient_Table.P_Balance) AS AvgOfP_Balance
    FROM Patient_Table
    GROUP BY Patient_Table.TherapNumber;

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Are these class assignments? Could build a report and use its Sorting & Grouping with aggregate calcs. This will allow display of detail records as well as summary calculations.
    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.

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

Similar Threads

  1. Replies: 12
    Last Post: 08-23-2016, 09:22 AM
  2. Replies: 6
    Last Post: 04-22-2015, 03:15 PM
  3. Replies: 2
    Last Post: 10-15-2014, 02:23 AM
  4. Replies: 1
    Last Post: 05-04-2013, 12:19 PM
  5. query using code
    By rohini in forum Queries
    Replies: 1
    Last Post: 05-17-2012, 03:46 AM

Tags for this Thread

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