Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Query using like to trieve field value with additional parameters

$
0
0

I have two tables, mod_music_category has a field id which autoincrements and the other table, mod_music_entries has category_id field whose value is mod_music_category.id but enclosed with "b" and "e"  .e.g."b mod_music_category.id e" no spaces like b1e.

 

I am trying to select all records from mod_music_entries whose category_id is LIKE or EQUAL to mod_music_category id field

as follows:

SELECT `c`.id, `c`.category, `e`.`category_id`, `c`.teaser, `c`.style FROM `".DB_EXTENTION."mod_music_category` `c` LEFT JOIN `".DB_EXTENTION."mod_music_entries` `e` ON( `e`.`category_id` = '%b`c`.`id`e%') ORDER BY c.`priority` ;

Its returning all values even if there is no join.

 

Is ther a better way. Thanks


Viewing all articles
Browse latest Browse all 13200

Latest Images

Trending Articles



Latest Images