Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Using CASE WHEN to check multiple rows of a table

$
0
0

So I have a table called MATERIAL with a field named MATERIAL_SHIPPED. It will either have a 1 or 0 value making it as shipped or not.

There may be multiple materials for each PROJECT record. I want to set a flag at the PROJECT level saying that each MATERIAL on the PROJECT was shipped.

I'm using CASE to do this, but how can I only flag when each MATERIAL is shipped? Using a CASE WHEN MATERIAL_SHIPPED = 1 THEN 1 AS PROJECT_SHIPPED_FLAG isn't working for me because of this.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>