deib97 Posted March 8, 2014 Share Posted March 8, 2014 (edited) I was trying for make a query for replace it. Because I dont understand with complex condition i make a query for each condition, but after i append all query each condition to one new table, sum of rows not same like table so2. I has 2 tables : so2 and pl2. maybe can be help me i attach in my dropbox *.sql : so2.sql and pl2.sql For distinct pl2 : i use this query : SELECT YEAR(`HRG_DATE`) AS Yr, MONTH(`HRG_DATE`) AS Mnth, DAY(`HRG_DATE`) AS Day, COUNT(*) AS Total FROM `pl2` GROUP BY YEAR(`HRG_DATE`), MONTH(`HRG_DATE`) And this image for describe condition : image Sorry i not attach media in here, bandwith killer. :pirate: And i was make query every condition, this example for no.3(image) like this : (for checking before i hide so2.`PLIDR` , so2.`PLVLS`) SELECT so2.`ORJ_DATE` , so2.`CUS_CODE` , so2.`INV_CODE` , so2.`PLIDR` , so2.`PLVLS` , pl2.`HRG_DATE` , pl2.`CUS_CODE` , pl2.`INV_CODE` , pl2.`HRG_NETT` , pl2.`HRG_VALA` FROM so2 INNER JOIN pl2 ON so2.CUS_CODE = pl2.CUS_CODE AND so2.INV_CODE = pl2.INV_CODE WHERE DATE( so2.ORJ_DATE ) BETWEEN '2013-01-02' AND '2013-06-27' ORDER BY so2.ORJ_DATE ASC How to make single query like this condition?? thanks for helping me.. Edited March 8, 2014 by deib97 Quote Link to comment https://forums.phpfreaks.com/topic/286816-how-to-replace-with-condision~help/ Share on other sites More sharing options...
deib97 Posted March 9, 2014 Author Share Posted March 9, 2014 any one can help me?? Quote Link to comment https://forums.phpfreaks.com/topic/286816-how-to-replace-with-condision~help/#findComment-1471906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.