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 8984395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:05:45+00:00 2026-06-15T21:05:45+00:00

Not sure how to explain this, as I have only basic SQL knowledge. I

  • 0

Not sure how to explain this, as I have only basic SQL knowledge. I need help with some logic to signal a user when a unique string is referenced more than once in a composite primary key.

A table I use contains a composite primary key which ties a unique “ItemCode” to a repeating “WarehouseCode”. The “QuantityOnHand” column lists how much we have of an item in each warehouse:

     _____PK_______
    |              |
ItemCode  |  WarehouseCode  |  QuantityOnHand
---------------------------------------------
   001             A                 100
   001             B                 500
   002             A                 600
   003             B                 250

etc.

How do I “signal” (create a boolean value?) when ItemCode 001 is in two separate warehouses?

The end result is a crystal report which somehow alerts the user when an item’s total quantity is split between two warehouses.

Thanks

  • 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-06-15T21:05:46+00:00Added an answer on June 15, 2026 at 9:05 pm

    Utilise GROUP BY and HAVING. For example this query will return a list of ItemCodes and a count of how many warehouses they are in where that count is greater than 1.

    SELECT ItemCode, COUNT(*)
    FROM table
    GROUP BY ItemCode
    HAVING COUNT(*) > 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I can explain this clearly. I have some simple HTML
Not sure exactly how to explain this but Imaging you have a table with
Im not sure how to explain this and im not use to SQL..this is
I'm really not sure on the best way to explain this, but we have
I am not sure this is really bubbling, I will explain. I have this:
Not sure if I can explain this correctly, but I am trying to execute
Not even sure how to explain this but I connect to a remote computer
I'm not sure exactly how to explain this, so I'll just start with an
I'm not sure how to best explain this, so this may be a bit
Not sure how best to explain this, so bear with me... I'm writing an

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.