i WANT TO ADD ANOTHER TABLE COLUMN NAME LEDGER_TYPE IN THE SAME QUERY. HERE IS MY BELOW CODE
$re=mysqli_query($con,"select * from ledger where shop_id=$shop_id and sub_id=0 limit 0,5");
while($ro=mysqli_fetch_array($re))
{
$head_id[]=$ro[0];
}
$head_id1 = implode(",",$head_id);
$asset=$head_id[0];
$liability=$head_id[1];
$income=$head_id[2];
$expense=$head_id[3];
$re=mysqli_query($con,"insert into ledger_temp(lev1,lev2,lev3,lev4) SELECT t1.ledger_id AS lev1, t2.ledger_id as lev2, t3.ledger_id as lev3, t4.ledger_id as lev4
FROM ledger AS t1
LEFT JOIN ledger AS t2 ON t2.sub_id = t1.ledger_id
LEFT JOIN ledger AS t3 ON t3.sub_id = t2.ledger_id
LEFT JOIN ledger AS t4 ON t4.sub_id = t3.ledger_id
WHERE t1.ledger_id IN($head_id1);");
its works fine for me but in the same query i want to update another column name **ledger_type ** with the combination of condition match
if it is asset then type 1
if it is liability then type 2
if it is incomes then type 3
if it is expense then type 4
please help me for solving this. Thanks in advance
which is something like
top of the code working fine. but in the same query i want to update another column name ledger_type with the following condition match
if it is asset then type 1 if it is liability then type 2 if it is incomes then type 3 if it is expense then type 4