Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SUBSTRING() / MID() Statement in Zend Framework 2

I'm trying to implement the following, pretty simple, query:

WHERE
  a.first_table IS NULL
  AND a.second_table IS NOT NULL
  AND SUBSTRING(b.third_table,5,2) = @plan_year;

As you might guess the first two statements are not really a problem. I currently fail at implementing the SUBSTRING() via Zend, as I want to keep the code DB-System neutral. Is there any way to do this ?

Thanks

like image 858
floo Avatar asked Aug 01 '26 03:08

floo


1 Answers

What about to use SUBSTR instead of SUBSTRING?

WHERE
  a.first_table IS NULL
  AND a.second_table IS NOT NULL
  AND SUBSTR(b.third_table,5,2) = @plan_year;
like image 185
Stanislovas Kalašnikovas Avatar answered Aug 02 '26 17:08

Stanislovas Kalašnikovas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!