• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 63
  • Last Modified:

VB.Net - SQL Query Dependent on Potential Value in a Column

Good Day Experts!

Can you help with a query design?

I have multiple lines of records in a table that make up a Batch of data...lets call it Batch 1234 and give it 5 records.  On each record is a field called Shipped.  It is either a 1 or a 0 value.  

I need a query that 1) Tells me if Batch 1234 is present in the table and 2) if any of the records in the batch have Shipped set to 1

Is this possible in one query without too much trouble?

Thanks,
jimbo99999
0
Jimbo99999
Asked:
Jimbo99999
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
that should do the job:
select max(shipped) as Shipped
from yourTableName
where batchid = 1234

Open in new window

0
 
Jimbo99999Author Commented:
Thanks...it works great!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now