# Case Statement help

**URL:** <https://www.epiusers.help/t/case-statement-help/67014>\
**Category:** Epicor ERP 10\
**Tags:** baq\
**Created:** [May 7, 2020, 3:06pm UTC](https://www.epiusers.help/t/case-statement-help/67014 "2020-05-07T15:06:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kimberley](https://www.epiusers.help/user_avatar/www.epiusers.help/kimberley/32/50847_2.png) [@Kimberley](https://www.epiusers.help/u/Kimberley)\
**Post date:** [May 7, 2020, 3:06pm UTC](https://www.epiusers.help/t/case-statement-help/67014/1 "2020-05-07T15:06:11Z")

</div>

I have a case statement all ready in my BAQ and works fine. I need add something else but get a syntax error.  
This is the original Case statement:  
 ![image](https://epiusers.help/uploads/default/original/3X/f/7/f7bb2bcb937eb3f815efe0abba91d4b9285eaa3a.png)

I thought I could do this…But what do I know…I am weak in this area…highlighted yellow is what I added.  
 ![image](https://epiusers.help/uploads/default/original/3X/7/4/7487c0fcf57244299fe99150daa579fae69f27f3.png)

---

<div class="post-metadata">

**Author:** ![Aaron\_Moreng](https://www.epiusers.help/user_avatar/www.epiusers.help/aaron_moreng/32/745_2.png) [@Aaron\_Moreng](https://www.epiusers.help/u/Aaron_Moreng)\
**Post date:** [May 7, 2020, 3:26pm UTC](https://www.epiusers.help/t/case-statement-help/67014/2 "2020-05-07T15:26:36Z")

</div>

I don’t really like nested case statements (if not required), and it looks like in this case you can simply assess each condition (assuming your conditions are mutually exclusive). This would help clean up the syntax confusion. I think you could do this:

```
case
	when condition1 = 1 then 'result1'
	when condition2 = 2 then 'result2'
	when condition10 = 10 then 'result10'
end

```

This allows you to maintain your conditions and results list easily without worrying about nesting it even further. Do be aware it will assess the conditions in the order received.

---

<div class="post-metadata">

**Author:** ![rbucek](https://www.epiusers.help/user_avatar/www.epiusers.help/rbucek/32/28841_2.png) [@rbucek](https://www.epiusers.help/u/rbucek)\
**Post date:** [May 7, 2020, 4:17pm UTC](https://www.epiusers.help/t/case-statement-help/67014/3 "2020-05-07T16:17:00Z")

</div>

try this…

```sql
(case when DMRHead.CheckOff3 = 1 then 'Prod' 
else (case when DMRHead.CheckOff4 = 1 then 'PUR' 
else (case when DMRHead.OutProcess_c = 1 then 'Outside' 
else '' end ) end) end)

```

---

<div class="post-metadata">

**Author:** ![Kimberley](https://www.epiusers.help/user_avatar/www.epiusers.help/kimberley/32/50847_2.png) [@Kimberley](https://www.epiusers.help/u/Kimberley)\
**Post date:** [May 7, 2020, 5:16pm UTC](https://www.epiusers.help/t/case-statement-help/67014/4 "2020-05-07T17:16:35Z")

</div>

THanks this one worked best for my situation.

I found my error…Works perfect
