Welcome Guest, Not a member yet? Register   Sign In
DB Query Question
#5

(12-05-2018, 05:40 AM)soneax Wrote: Can you answer me another question?

If i want to query 2 tables, i join the second one based on ID for example, how can i loop the second table results with foreach if there is no child arrays for this table results?

I did not understand what you mean by "if there is no child arrays for this table results".
In the above query I used LEFT join. If you want to return all the results from second table ('users u2' in this case) use right join. 
Also learn Joining tables, that is the advantage of RDBMS
Reply


Messages In This Thread
DB Query Question - by soneax - 12-05-2018, 03:15 AM
RE: DB Query Question - by neuron - 12-05-2018, 03:54 AM
RE: DB Query Question - by soneax - 12-05-2018, 05:19 AM
RE: DB Query Question - by soneax - 12-05-2018, 05:40 AM
RE: DB Query Question - by neuron - 12-05-2018, 11:18 PM
RE: DB Query Question - by soneax - 12-06-2018, 04:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB