mysqldump - mysql rbar situation -
What would be the best way to handle this situation?
I'm working off the shelf software, and it stores the user-defined field names in the database as a line instead of adding a new column in the table. It looks like this:
id FIELDNAME fieldValue propertyId 1 Latitude 23.192 id_property1 2 Longitude -10.323 id_property1 3 Latitude 23.192 id_property2 4 Longitude -11.824 id_property2 5 Latitude 25.254 id_property3 ""
I enters the need to filter the table based on user input so FIELDNAME and fieldValue, user, FIELDNAME = "Latitude" and fieldValue = "23.192" this return id_property1 and id_property2 Come on. But the user enters, then FIELDNAME = "Latitude" and fieldValue = "23.192" and FIELDNAME = "Longitude" and fieldValue = "- 10.323" It will just id_property1 back
I use loops Having made an approach. Php, but I'm worried that it will be down under a lot of records.
Thank you!
Use a join self:
p0 the propsTable .propertyId selection as well as P0 PlkpropertyId = P0kpropertyId where p0.fieldName = 'Latitude propsTable as p1 on tourist and p0.fieldValue = 23.192 and p1.fieldName =' longitude 'and p1.fieldValue = - 10.323
Comments
Post a Comment