i want to put the name of tbl_account
to **tbl_lead fieldname(acc)*
* but can't do it. here in table account's name is dragged and merge with table leads in acc field of table leads
here is the query:
$sql = mysql_query("select tbl_lead.*, tbl_account.name from tbl_lead INNER JOIN tbl_account ON tbl_lead.acc= tbl_account.id");
Above result inner join show nothing (no error) but if we do left join then there is blank in *acc*
field of *tbl_lead*
and if i tried right join then only **acc
** field of **tbl_lead
** is shown please help me??
Your condition
tbl_lead.acc= tbl_account.id
is never true. Hence, when left joining, no results are joined, returning only left table and nulls for rest, symetrically so for right join. For inner join, only joned rows get returned, which, in your case must be none.
You wrote you are joining a name on an ID? those values(string, int) do not sound like they would match.
Check that indeed that condition should be true. If you expect it to be true, perhaps you are joining on wrong columns, or perhaps the column values do not match even if similar(perhaps some extra spaces in the data)
Check the acc value in tbl_lead present in id value of tbl_account.
if the value of acc in tbl_lead present in value of id in tbl_account then only return values.