Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle select query with substr

I have a table which looks like:

DAYDATE     TIMEOFDAY   USERID
18-JUL-12   Afternoon   mistu4u
18-JUL-12   Noon        mistu4u
20-JUL-12   Noon        mistu4u
21-JUL-12   Afternoon   mistu4u
11-SEP-12   Afternoon   rimo
06-AUG-12   Noon        rimo
14-JUN-12   Noon        mistu4u

Now I want to fetch those values for mistu4u whose daydate's month is 'jul'.I tried like

select * from mealdb where userid='mistu4u' and substr(daydate,4,3)='jul';

But it is giving 'no data found'.

like image 773
Mistu4u Avatar asked Apr 14 '26 01:04

Mistu4u


1 Answers

Is your install case sensitive? Does this SQL work?

select * from mealdb where userid='mistu4u' and substr(daydate,4,3)='JUL';
like image 140
ProfessionalAmateur Avatar answered Apr 16 '26 02:04

ProfessionalAmateur



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!