Okay
  Public Ticket #1049798
Mysql query
Closed

Comments

  •  3
    ilkkaH started the conversation

    Hi there, I am trying to create mysql based table from form entries (gravityforms). My problem is i can find the data but i can not have it in columns by field number. With my sql query. See the screen shot attached. 

    1. I have been trying to achieve this by first querying the correct table wp_rg_lead_detail

    This part works fine


    2. The i query for the correct form

    wp_rg_lead_detail.form_id

    this part works fine


    3. Then i query for the correct field number

    wp_rg_lead_detail.field_number (for example field number 1)

    This part works fine


    3. Here comes the problems

    As i try to add another column (for example field number 2)

    wp_rg_lead_detail.field_number


    It gives me no results. Do you have any idea how could i achieve this, i can get all the entries in same column but that does not lead to anything. I hope you can help me somehow.


    SELECT wp_rg_lead_detail.form_id,
           wp_rg_lead_detail.field_number,
           wp_rg_lead_detail.value
    FROM wp_rg_lead_detail
    WHERE 1=1
       AND wp_rg_lead_detail.form_id = '1'
       AND wp_rg_lead_detail.field_number = '24'
       AND wp_rg_lead_detail.field_number = '3'

    this example is now giving me any results.
  •  1,825
    Miloš replied

    Hi ilkkaH,
    Thank you for your purchase.

    If you take a look at our documentation about MySQL queries you will notice this:

    Notice: "Please note that MySQL query constructor is not an ‘ultimate generator’, it should be consider a helper that constructs a suggestion of a query trying to ‘guess’ what you want. We constantly work on improving it, but SQL is such a complicated and flexible language that full automation for constructing queries is hardly possible. So the more complicated your request is, the higher is the chance that it will not return exactly what you need.

    The best solution to write MySQL query by your own and try to execute it in phpMyAdmin or any other database system administration tool and see does it returns data that you want. 
    Please give it a try and tell me does it returns what you want.
    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  3
    ilkkaH replied

    Ok. Thanks for your answer. 

    But if get my sql query working in phpMyAdmin will the constructor or the wpdatatables to be able to handle it if it is written correctly?

  •  1,825
    Miloš replied

    Hi ilkkaH,

    If your query is working you can use that query as an input type, so it should not have any problems.
    But because it is MySQL, sometimes it can be complicated but if query is good it should not be some issues.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables