OK, the purpose of this query is to check whether a record exists in table two, and if that type is Updates to duplicate, if it does not, then update it in the original. I have to check three areas, and all of them should be eligible as a duplicate entry.
At this time, it checks the correct table, finds if there is a duplicate, and changes I test on the position of 1 to 2 on all 9 records, however, it is only "duplicate "The first record is changing, even if they are all duplicates.
Am I able to use 'AND' case statement? If not, then someone has a suggestion that how can I change this query to work? I have tried to use a SELECT subquery, but it is not working.
Here is the code:
$ query = "update first_table f left second_tables ON f .co_id = s.co_id SET f.status = 2, f.type = The case when the SLTFLTT and S.Lang = F.Lang and S.Nets = FNITS then 'Duplicate' ELSE 'original' END WHERE f.co_id =: coid and f.type = : Rtype and f.status =: "status"; $ Params = array (); $ Params [] = array (': coid', $ co_id, 'int'); $ Params [] = array (': replay', 'upload', 'str'); $ Params [] = array (': position', '1', 'int'); $ Db- & gt; Query ($ query, $ params);
I used a little bit of advice from Ali Arshad and SKFfield. ..and come up with the solution!
$ query = "upstate first_tables and join with second second f.co_id = s.co_id SET f.status = 2, f.type = case when (select_fresh_preblef.prop_id F where SLETT.F.T.T.T. and S.Lang = F.Lange and S.Nets = F.Nets) then 'duplicate' ELSE 'original' end hoofe F.CO.ID =: Cody and F. Type =: Retype and F. Stats =: Status "; $ Params = array (); $ Params [] = array (': coid', $ co_id, 'int'); $ Params [] = array (': replay', 'upload', 'str'); $ Params [] = array (': position', '1', 'int'); $ Db- & gt; Query ($ query, $ params);
No comments:
Post a Comment