Solved

Scan table for records > 0

Posted on 2013-05-30
3
208 Views
Last Modified: 2013-05-30
I have an Attendance Grid called tblAttendanceGrid.  I have the following columns

Month
Total
DataPresent

How can I write an SQL statement that scans my table and checks to see if anyone has a Total > 0 each month, it will put a "1" in the DataPresent column for that specific record.
0
Comment
Question by:al4629740
[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
3 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39208438
Something like...

SELECT Month, Total, CASE WHEN TOTAL > 0 THEN 1 END AS DataPresent FROM MyTable
0
 

Author Comment

by:al4629740
ID: 39208492
Yes, however I actually want to put a value of "1" into the actual table
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 500 total points
ID: 39208502
Something like...

UPDATE MyTable SET DataPresent = 1 WHERE (Total > 0)
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Backup & Restore 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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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