Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-07-26
2
Medium Priority
?
56 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
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

783 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