var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Can someone help in this?
I am having records in a field (field_id) of a table (in mysql database), which is having ID stored per line, for example
above is one record, and I have many records similar to that.
and, when I am writing the query SELECT * FROM $table_name where field_id like '%1%'
then the rows having the results like
are also returned. I am upset. How to overcome this problem?
I found one fix to this, but it fails in most of the conditions, this is -
SELECT * FROM `$table_name` WHERE field_id like '%\n1%' OR '%1\n%'
This fails, when the (field_id) have only one record, for example, '1'. I want to catch everything, where line equals to 1, whether single line in the record, or many.
I am going mad for this.
Can someone provide me any way? Thanks.
Upset: Have you tried Xanax?
Originally Posted by mohansinfh
SQL: can you reword this question to make it easier to understand?
my sincere advice: normalize your data
otherwise your query will always perform a table scan, i.e. it will start off really slow and get slower and slower the more rows you have
but if you insist on keeping the current design, try this --
WHERE CONCAT(',',REPLACE(REPLACE(field_id,'\r',''),'\n',','),',') LIKE '%,1,%'