Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 886779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:07:33+00:00 2026-05-15T13:07:33+00:00

here’s my code that works thanks to Jim b: SELECT IIf([Lab Occurrence Form].[1 0

  • 0

here’s my code that works thanks to Jim b:

SELECT IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11 Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [Occurrence Code], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
GROUP BY [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]
HAVING ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0)
ORDER BY Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) DESC;

it returns this:

1.1 Specimen Mislabeled 159
1.3 QNS-Quantity Not Sufficient 84
1.9 QNS- Specimen Spilled in transit    72
1.6 Test Requisition Missing    17
1.11 Other  3
1.11 Other  3
1.1 Specimen Mislabeled-new ID # given  2
1.11 Other  2
1.11 Other  2
1.1 Specimen Mislabeled & 1.6 Test Requisition Missing  1
1.11 Other  1
1.11 Other  1
1.11 Other  1
1.11 Other  1
1.11 Other  1
? Nothing in comments portion of QuikLab    1
1.11 Other  1
1.11 Other  1
1.4 Tests Missed/ Wrong Test Ordered    1
1.4 Tests Missed/Wrong Test Ordered 1
1.6 Test Requisition Missing & 1.7 Specimen Lost    1
1.8 Specimen not handled/processed correctly & 1.10 Operator Error(?)   1
1.11 Other  1
1.11 Other  1

this is exactly what i need HOWEVER, there is one slight thing off. i need it to be counting ‘1.11 Other’

how do i do it? another words this is the output I need:

? Nothing in comments portion of QuikLab    1
1.1 Specimen Mislabeled 159
1.1 Specimen Mislabeled & 1.6 Test Requisition Missing  1
1.1 Specimen Mislabeled-new ID # given  2
1.11 Other  19
1.3 QNS-Quantity Not Sufficient 84
1.4 Tests Missed/ Wrong Test Ordered    1
1.4 Tests Missed/Wrong Test Ordered 1
1.6 Test Requisition Missing    17
1.6 Test Requisition Missing & 1.7 Specimen Lost    1
1.8 Specimen not handled/processed correctly & 1.10 Operator Error(?)   1
1.9 QNS- Specimen Spilled in transit    72

as you can see there is only one occurrence of 1.11 Other and a total count of 19

JIM B suggests this:

Use your IIF statement all the way through your group by and having clauses – Jim B

but i do not understand how to implement it. please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:07:34+00:00Added an answer on May 15, 2026 at 1:07 pm

    More of a sql server guy so i am not sure if you can do this but have you tried:

    SELECT IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11 Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [Occurrence Code], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])
    FROM [Lab Occurrence Form]
    WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
    GROUP BY IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11 Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])
    HAVING ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0)
    ORDER BY Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) DESC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is my code, which takes two version identifiers in the form 1, 5,
Here is my code (Say we have a single button on the page that
Here is the field declaration in a form: max_number = forms.ChoiceField(widget = forms.Select(), choices
Here's my situation. I've noticed that code gets harder to maintain when you keep
Here is some code on the javascript side for form-based uploads: iframe.setAttribute('src', 'javascript:false;'); I'm
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.