Prudhviraj Prudhviraj - 1 year ago 80
SQL Question

How to write a query to display the mobiles whose manufacturing date is specified as 2010?

[1]

Based on this table, i wrote a query to display mobiles whose date of manufacturing is before 2010.

select ime_no,model_name,manufacturer,date_of_manufac
from mobileinfo
where date_of_manufac<2010;


but, error occurred

where date_of_manufac<2010

*

ERROR at line 3:

ORA-00932: inconsistent datatypes: expected DATE got NUMBER

help me in solving this error and the query to display mobiles whose date of manufacturing is before 2010!!!

Answer Source
select ime_no,model_name,manufacturer,date_of_manufac
from mobileinfo
where STR_TO_DATE(DATE_FORMAT(date_of_manufac,%Y),%Y)<2010;

Here i had added functionDATE_FORMAT and STR_TO_DATE.

Try above query.

Hope this will help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download