Hi
I have Table OWHS with 2 fields BPLId,WhsCode. I want all those records with Branch having more than 1 Warehouse Code
Thanks
Hi
I have Table OWHS with 2 fields BPLId,WhsCode. I want all those records with Branch having more than 1 Warehouse Code
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sangeetha SPosted Mar 26, 2025, 5:10 AM
To retrieve records from the
OWHStable where a branch (BPLId) has more than one warehouse code (WhsCode), you can use SQL to group the records byBPLIdand filter those groups having more than oneWhsCode. Here's a query that should help:Emily FosterPosted Mar 26, 2025, 5:08 AM
Hello! It sounds like you are looking to retrieve specific records from the OWHS table based on the condition of having more than one Warehouse Code associated with a Branch.
To achieve this in SQL, you can use a GROUP BY clause along with the HAVING clause to filter the results based on the count of Warehouse Codes associated with each Branch. Here's an example query that might help you accomplish this:
In this query:
- We are selecting the BPLId field and counting the number of WhsCode values associated with each BPLId using the COUNT function.
- The GROUP BY BPLId groups the records by Branch, and the HAVING clause filters the groups to only include those with a Warehouse Count greater than 1.
Running this query will give you the Branches along with the count of Warehouse Codes for each Branch where the count is more than one.
If you have any specific database system in mind (e.g., MySQL, SQL Server, Oracle), you may need to adjust the syntax slightly based on the SQL dialect supported by that system.
I hope this explanation and example help you in retrieving the desired records from your OWHS table. Let me know if you need further assistance or have any other questions!