Link to home
Start Free TrialLog in
Avatar of developer2012
developer2012

asked on

How to check whether the data has two,three and four values in it separated by (,) and eliminate it?

How to check whether the data has two, three and four values in it separated by( (,) and eliminated it?

For example when I retrieve a primary key from the database.  Sometime, it has
Individual value --> (1234)
two values --> (1234,1234)
three value --> (1234,1234,1234)

Four values --> (1234,1234,1234,1234)

well, I am supposed to proceed with the only individual value and eliminate the rest of the things?

Can somebody please help how to develop the logic to write the function?

Thanks everyone !
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

That looks weird.  (Check the table definition to confirm the key are string values).  How do you retrieve that primary key.
Avatar of developer2012
developer2012

ASKER

Yes, those are string values. I retrieve those values by querying the data.

For example

Select primarykey from database where columnname = columnname;

and It returns values like;

1234,
1234,1234,
1234,1234,1234,
1234,1234,1234,1234,

I mean sometimes it may have the single value too, sometime double values

but I am suppose to use only one string value. i.e. something like the format of '1234' and ignore the rest.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Andy,

I will implement the function and update here.

Thanks,
D.