boon_chong Posted February 16, 2007 Share Posted February 16, 2007 I'd like to query only the month of stockmovement.date, but when i use stockmovement.month(date) the error come out. Somebody please help me to figure out. thanks. $query = "select distinct employee.itemNo,employee.itemDesc,employee.date, employee.outlet,stockmovement.barcode,stockmovement.quantity,stockmovement.date from employee,stockmovement where employee.itemNo =stockmovement.barcode group by employee.itemNo"; Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/ Share on other sites More sharing options...
Greaser9780 Posted February 16, 2007 Share Posted February 16, 2007 Without stockmovement.date this query still doesn't work does it? Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/#findComment-186051 Share on other sites More sharing options...
btherl Posted February 16, 2007 Share Posted February 16, 2007 If you group by itemNo, it implies there are multiple entries for each itemNo, and you want to group them together. Then there is the question of how you group them together. You can take the sum, the count, the average, or many other options. What does the query do if you remove the group by? Does it give extra rows that you don't want? Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/#findComment-186056 Share on other sites More sharing options...
boon_chong Posted February 16, 2007 Author Share Posted February 16, 2007 What i want is to get the month, instead of the whole date. Thx. Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/#findComment-186075 Share on other sites More sharing options...
roopurt18 Posted February 16, 2007 Share Posted February 16, 2007 I responded to your other thread in the PHP Help area. Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/#findComment-186087 Share on other sites More sharing options...
fenway Posted February 16, 2007 Share Posted February 16, 2007 You can use MONTH() to get the month, or DATE_FORMAT() to get a pretty version of the month. Quote Link to comment https://forums.phpfreaks.com/topic/38724-query-problem/#findComment-186212 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.