ajmeireles Posted January 4, 2019 Share Posted January 4, 2019 Hello, everyone! Happy new year! Someone can help me to understand how I can check if a specific(or all) customers have one same value set in "value" of a specified products custom field? I'm trying do it using MYSQL, but doesn't have success.. For example: if I look for ID 4 on "relid" of tblcustomfieldsvalues table, I receive all customer custom fields, as birthday. However the products custom field for this customer(id 4) is using relid 61. How I can get it? How understand it? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 8, 2019 Share Posted January 8, 2019 On 04/01/2019 at 18:20, ajmeireles said: Someone can help me to understand how I can check if a specific(or all) customers have one same value set in "value" of a specified products custom field? you should be able to do it from the Product/Services page in the Admin Area if that's easier for you... On 04/01/2019 at 18:20, ajmeireles said: I'm trying do it using MYSQL, but doesn't have success.. For example: if I look for ID 4 on "relid" of tblcustomfieldsvalues table, I receive all customer custom fields, as birthday. However the products custom field for this customer(id 4) is using relid 61. when if you wanted all customfield values for ID4, then it's a simple query... SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' but that will give you all types of customfield values (addon, client, product, support etc) - if you just wanted a specific result, specify the fieldid (which equals the id value in tblcustomfields) in the query... SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' AND tblcustomfieldsvalues.fieldid = '61' 0 Quote Link to comment Share on other sites More sharing options...
ajmeireles Posted January 9, 2019 Author Share Posted January 9, 2019 23 hours ago, brian! said: you should be able to do it from the Product/Services page in the Admin Area if that's easier for you... when if you wanted all customfield values for ID4, then it's a simple query... SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' but that will give you all types of customfield values (addon, client, product, support etc) - if you just wanted a specific result, specify the fieldid (which equals the id value in tblcustomfields) in the query... SELECT * FROM tblcustomfieldsvalues WHERE tblcustomfieldsvalues.relid = '4' AND tblcustomfieldsvalues.fieldid = '61' Sorry due abou my long question, Brian! As a resume, I want understand how is associated the relid id of tblcustomfieldvalue with the customer. For example, at same time that customer ID is 4 to custom fields of register, the customer ID to the product custom field in tblcustomfieldvalue is other! Did you understand me? See it: Looking for register custom field 235: (custom field 235 is named as birthday)- See that relid is correct! The customer ID is 2 and relid was displayed as 2, it's correct due the customer id is really 2! Looking for a VALUE inserted on specific custom field of a product that is used to customer with id 2:- See that relid id on this case is other, different of the REAL CUSTOMER ID, on this case the relid was 626. I want understand it! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 10, 2019 Share Posted January 10, 2019 23 hours ago, ajmeireles said: As a resume, I want understand how is associated the relid id of tblcustomfieldvalue with the customer. then you should probably use Google and search for "relational databases" and get reading - otherwise it might take me all afternoon to walk you though this! but it might help if I quickly told you that relid in tblcustomfieldvalues does not always relate to a customer ID - it will do if it's a client custom field; if it's a product, it will relate to tblproducts; if it's a support custom field, it will relate to tbltickets; if it's a product addon custom field it will relate to the id in tbladdons. so as you can now hopefully see, you can't just take a relid value from tblcustomfieldvalues and know for sure what it is. you will have to check the fieldid value as that will give you the id value in the tblcustomfields database table and from that table you will be able to tell what type of custom field it is (addon/client/product/support etc)... and once you know the type, you will know which table that the relid is referring to. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.