Hi,

please tell me can we create function based index in my sql if yes then how...? if no the why..? i want to create index on this query, here we have a my sql query--

*/

$sql="select count(opportunity_code) as opc, month(created) as mon from tbl_oppourtunities where abs(DATEDIFF(date(now()),created)) <= 365 and year(created)=year(now())";

/*

please reply me asap .


Thanks

Best regrd
Jatashankar patel

Add a column to your table which contains the function value, and create a trigger which computes this function value on any update of the record. Then you can use an index on this column.

Thanks for your quick reply.

Best regard
jatashankar patel

Add a column to your table which contains the function value, and create a trigger which computes this function value on any update of the record. Then you can use an index on this column.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.