Join where
Join where
shantiram
Posts: 13Questions: 5Answers: 2
Hi, first of all I want to say I am really impressed by this product.
I was wondering if it's possible to create an Editor instance from a JOIN/WHERE query like this:
sql = 'SELECT first_name, last_name, email, phone, enrolment.enroldate, enrolment.price FROM students
INNER JOIN enrolment on students.id = enrolment.student_id WHERE enrolment.course_id = " . '$q' . '"'
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
sure, you could use ajax like in this example:
https://datatables.net/examples/data_sources/ajax.html
From what I understand the example you posted does not create an editable table. I would like to edit the table.
what are you using on the servers side? If you are using PHP or .NET I recommend using the respective Editor libraries. As far as I know Editor does not support an inner join but you should be able to get to the same result using a left join as well.
https://editor.datatables.net/examples/advanced/joinLinkTable.html
You can't have an editable table with just this one SQL-statement you provided. You would need INSERT, UPDATE and DELETE statements as well. That is what Editor automatically generates for you if you are using the PHP or .NET library.
Thank you. I managed to modify the join.php and join.html to create a left join on the tables I wanted.
I can see there is an option to include WHERE clause. But I don't quite understand how to use it.
Would be super grateful for any hints or help.
This is the code I have so far:
Did you see this? https://editor.datatables.net/manual/php/conditions
Here are a couple of examples from my own coding:
a very complex where clause:
a simple where clause:
and one more ....