1
感謝幫助我在這個問題上:CI高級SQL查詢?
http://stackoverflow.com/questions/33182460/mysql-data-collection-multiple-table
而現在,因爲我是在框架的新手。誰能幫我這個查詢轉換成能由笨3理解和正確運行:
select sales.id, sales.refid, reference.refname, sales.invoice,
sales.itemid, sales.price as sellprice, purchase.price as buyprice,
sales.price - purchase.price as profit from sales
left outer join reference on reference.refid = sales.refid
left outer join purchase on purchase.itemid = sales.itemid
而對於addtional問題在什麼地方或如何使CI執行多個查詢,例如:
INSERT INTO sales VALUES (null , 001 , 1501 , ss01 , 12000);
INSERT INTO purchase VALUES (null , ss01 , 10200);
UPDATE reference SET purchasedate = now() WHERE refid = 'ss01';
看到這一點,怎麼樣第二個問題?關於多個查詢? –
@SuryaTanamas答案已更新。 –