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

Jimbo99999
Jimbo99999 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior .Net Consultant
Top Expert 2016
Commented:
that should do the job:
select max(shipped) as Shipped
from yourTableName
where batchid = 1234

Open in new window

Author

Commented:
Thanks...it works great!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial