I need to be able to add a hyphen '-' to the end of a date column based on certain criteria. If field3 has more then one 'VISIT' value. Based on account number. Each account number is broken down into detail lines. **(I can't have hyphens for all the dates in this field.)** So for example there may be 5 of the same account number in the table and in the detaillines field it would be numbered 1-5 based on that account number. What is an effective way of doing this??? Function?? If so could I get an example? Sorry if this is to vague, please let me know if it is and I will try to make it better. *** 00/00/00 *** 00/00/00 to this *** 00/00/00 **-** *** 00/00/00 Each line representing a row. Based on the above criteria.
Can you paste a copy of your SELECT statement? Also, how do you know if Field3 has more than 1 value? Is it a delimited string of values stored in 1 field? If so, it sounds like you might just need a CASE for that column. Let's say Field3 can be a single value or a comma-delimited list with multiple values. In that case, something like this might work: DateField = DateValue + CASE WHEN CHARINDEX(',', Field3, 1) > 0 THEN ' - ' ELSE '' END If my guesses were wrong, I can change my answer after I have your answers to my questions.