Jump to content

Recommended Posts

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: :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 by deib97
Link to comment
https://forums.phpfreaks.com/topic/286816-how-to-replace-with-condision~help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.