I'd like to say that I'm still learning how to use SQL so what I am asking might be very easy for some of you.
So, let's suppose that I have a column called SAMPLE, and one column called BATCH. Also, a BATCH contains a few SAMPLEs and for some reason there is a flag linked to the SAMPLE column (SAMPLE_FLG).
The BATLCH_FLG is there to show that at least one of the samples contained in that batch was flagged as 1.
You can visualize this scenario in the following table:
How can I obtain with a SQL query just a single 1 for each batch in the BATCH_FLG column?
What I mean is that I shouldn't have 1 multiple times even if more than one sample for each batch is flagged as 1 (such as in the last three rows).
The position of the 1 in the BATCH_FLG column is not important.
I hope you can help me.