Solved

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

Posted on 2016-07-26
2
48 Views
Last Modified: 2016-07-26
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
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41729962
that should do the job:
select max(shipped) as Shipped
from yourTableName
where batchid = 1234

Open in new window

0
 

Author Closing Comment

by:Jimbo99999
ID: 41730277
Thanks...it works great!
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question