Perad Posted September 8, 2009 Share Posted September 8, 2009 Hello, can someone explain to me why this query isn't working? What I am trying to do is get the entire coupon table out. Coupons are linked to companies via coupon.company + company.id I am trying to get all coupons where a company begins with letter b. What I think I am doing is this. Selecting all fields from the coupon table, selected data from coupons table, I am then joining the companies and coupons table with the company/id fields. I am then getting all results based on the company name. Obviously something is wrong. Could someone tell me what please. SELECT `be_coupon`.`name`, `be_coupon`.`link`, `be_coupon`.`thumb`, `be_coupon`.`category`, `be_coupon`.`company`, `be_coupon`.`expires` FROM `be_coupon` JOIN `be_coupon_companies` ON `be_coupon_companies`.`id` = `be_coupon`.`company` WHERE `be_coupon_companies`.`name` LIKE '%b' Quote Link to comment https://forums.phpfreaks.com/topic/173512-query-not-working-no-error-no-results/ Share on other sites More sharing options...
suresh64633 Posted September 8, 2009 Share Posted September 8, 2009 Hi Your query seems to be correct except your Like condition. Like should be ` LIKE 'b%' As you want all company begin with letter 'b'. Quote Link to comment https://forums.phpfreaks.com/topic/173512-query-not-working-no-error-no-results/#findComment-914636 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.