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

Recommended Answers

All 2 Replies

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.