Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 MySQL
Here i have 1 field which contains coma separated value i want split it in query
 

 
i have value 1,2,3,4
 
i want to see like this
 
value1 value2 value3 value4
1 2 3 4
 
Like different fields
 
can any 1 help me please
adv thanx
Posted 29-Mar-13 22:08pm
Comments
AnnuBhai at 30-Mar-13 3:16am
   
how ??????
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I would use VB6 for such task. Anyway you may have a look at MySQL String Functions[^] (I guess iterating LOCATE and SUBSTR will do the job).
  Permalink  
Comments
Maciej Los at 30-Mar-13 8:19am
   
Why? MySQL database engine enable to create temporary tables and do many other things...
Please, see my answer.
I vote 4, because of good tip to use MySQL functions.
CPallini at 30-Mar-13 9:27am
   
Because in VB6 you may do that in a single call.
Maciej Los at 30-Mar-13 12:34pm
   
Single call (Split function) for each record fetched from database ;)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Please use the Below code, may it will help you. it is working fine in MS SQL.
 
select Replace(PhoneNo,',',' ') from EMP
 
Thanks
Zubair
  Permalink  
v2
Comments
Maciej Los at 30-Mar-13 8:16am
   
It isn't correct answer. REPLACE function will replace some string with other string, but does not split string into columns.
Please, correct it or delete to prevent down-voting.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 535
1 OriginalGriff 275
2 BillWoodruff 260
3 Shweta N Mishra 244
4 Deepu S Nair 230
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,818
2 DamithSL 4,958
3 Manas Bhardwaj 4,539
4 Maciej Los 3,755


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 30 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100