Can't add two references to the same table in one grid

QuestionsCan't add two references to the same table in one grid
Andres B asked 9 years ago

I have a situation where I have a main table with two references to another table.
I have a query similar to this:

SELECT AS name1, AS name2, sen_main.moredata FROM sen_client AS client1, sen_client AS client2, sen_main WHERE idclient1 = client1.idclient AND idclient2 = client2.idclient

When I call the grid, only the first column is populated. I tried different combinations, adding more columns, one with and another without alias, and the result is always the same, only the first reference is shown, the second reference is always left blank.

Can someone tell me the way I need to write my query so that it will populate both columns?

Thanks in advance.

1 Answers
Abu Ghufran answered 9 years ago


Please make sure you set column name as alias OR field name if alias is not used.

// for col1
$col["name"] = "name1";

//for col2
$col["name"] = "name2";

Also try running your query on sql ide e.g. phpmyadmin to verify if it is returning data.
If still not resolved, please post your code. You can use for sharing.

Your Answer

13 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?