|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here! |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I need to select some information that are in a database..I have category field that contain the numbers of some categories, this field is a text field
I need to select category 5 My database structure is: id---name-------category 1 Test 5 2 Good 12 15 7 5 3 Test 2 123 15 10 4 Test 3 33 424 5 Test New 6 Better 12 I use the following query: select id from db_table where category in('','5') MySQL engine select only id=1, why it doesn't select also ids: 2 and 5 |
|
|||
|
Code:
select id from db_table where category in('','5')
I would use something like the following: Code:
Select id From db_table Where category REGEXP "(^| )(5)( |$)" Code:
Select id From db_table Where category REGEXP "(^| )(5|2|3)( |$)" |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |