Paid commission - peer review of mySQL query
Permalink
Seeking mySQL expert to review query which displays images from projects within a cost range.
Project metrics are entered via a form including cost per square meter rates for prescribed scope of work, e.g. 'New Build', 'Refurbishment' etc.
See attached screen grab.
Forms are built using Six Eight Media's Advanced Forms add-on for C5.
The nature of the form builder is that it is requiring multiple joins which cause the query to take 20+ seconds to show images.
There is a range slider that gives a range of construction rates, e.g. $1000-$2000 per square meter.
Described as c.value in query below.
There is a drop down that prescribes if the images displayed are of New Build, Refurb, Bathrooms etc.
ffID 181 is the Project Name
ffID 289 is a 'Yes' 'No' option for whether to make the project public
The query follows:
Interested parties please reply with rates and availability.
Regards
Peter Kable
Project metrics are entered via a form including cost per square meter rates for prescribed scope of work, e.g. 'New Build', 'Refurbishment' etc.
See attached screen grab.
Forms are built using Six Eight Media's Advanced Forms add-on for C5.
The nature of the form builder is that it is requiring multiple joins which cause the query to take 20+ seconds to show images.
There is a range slider that gives a range of construction rates, e.g. $1000-$2000 per square meter.
Described as c.value in query below.
There is a drop down that prescribes if the images displayed are of New Build, Refurb, Bathrooms etc.
ffID 181 is the Project Name
ffID 289 is a 'Yes' 'No' option for whether to make the project public
The query follows:
$this->db->query('SET SQL_BIG_SELECTS=1'); $sql = " SELECT DISTINCT d.value as project_name,fv.fID,c.value as project_size FROM sixeightformsFields f LEFT JOIN sixeightformsAnswers a ON f.ffID = a.ffID LEFT JOIN sixeightformsAnswerSets aset ON a.asID = aset.asID LEFT JOIN FileVersions fv ON a.value=fv.fID AND fv.fvID = ( SELECT MAX(fvID) FROM FileVersions fv2 WHERE fv.fID=fv2.fID )
Viewing 15 lines of 39 lines. View entire code block.
Interested parties please reply with rates and availability.
Regards
Peter Kable
Hi Darshan,
We solved it by using INNER JOIN as follows
We solved it by using INNER JOIN as follows
$this->db->query('SET SQL_BIG_SELECTS=1'); $sql = " SELECT DISTINCT d.value as project_name,fv.fID,c.value as project_size FROM sixeightformsFields f JOIN sixeightformsAnswers a ON f.ffID = a.ffID INNER JOIN sixeightformsAnswerSets aset ON a.asID = aset.asID INNER JOIN FileVersions fv ON a.value=fv.fID AND fv.fvID = ( SELECT MAX(fvID) FROM FileVersions fv2 WHERE fv.fID=fv2.fID )
Viewing 15 lines of 39 lines. View entire code block.
I am really interested to work on this task.
So Can We discuss on further?
I look forward to your response.
Thanks & Regards,
Darshan Shah
skype:shah.darshanv