Is there a way to generate an SQL query in Laravel 4 (using the query builder) which supports more than one table in the "from" clause, without using joins?
I want to make something like this:
SELECT * FROM table_1 as t1, table_1 as t2...
Can this be done without using joins? I noticed that the from() method strips anything after the table name/alias:
->from('table_1 as t1, table_1 as t2')
becomes (yes, with the comma at the end):
table_1 as t1,
Thanks for any help at all.
The OP answered and updated his question. To make it clearer the answer is:
Antonio Carlos Ribeiro - thanks for the answer, but as I posted in the question, I was trying to avoid using joins, since I have a complex query ready but it does not use joins (and there is a reason for that).
I managed to get it done on my own :) Actually, this was quite simple after all... All I had to do is use DB:raw()
which allows to inject a non-formatted portion of the query:
->from(\DB:raw('table_1 as t1, table_1 as t2'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With