fonecave Posted November 22, 2016 Share Posted November 22, 2016 Hi Guys, I have a JET SQL query that i need to convert to MYSQL (Appologies too if this is posted in the wrong section.. i never know whether to go PHP or MYSQL!) Im not being lazy.. ive tried for hours but cannot get it to work, it has two depth inner join and a group by with a where (with 1 criteria)... If anyone can help id massively appreciate it and also explain how you got there... SELECT Count(tbl_Items.ItemID) AS CountOfItemID, tbl_LU_Collections.CollectionDescFROM (tbl_Items LEFT JOIN tbl_LU_Categories ON tbl_Items.ItemCategory = tbl_LU_Categories.ItemCatID) LEFT JOIN tbl_LU_Collections ON tbl_LU_Categories.CollectionID = tbl_LU_Collections.CollectionIDWHERE (((tbl_Items.RetailProduct)=-1))GROUP BY tbl_LU_Collections.CollectionDesc; Quote Link to comment https://forums.phpfreaks.com/topic/302595-php-mysql-query-help/ Share on other sites More sharing options...
mac_gyver Posted November 22, 2016 Share Posted November 22, 2016 what sort of error or problem are you having with this query? if you remove all the (), which don't appear to be doing anything, it looks like it should work. Quote Link to comment https://forums.phpfreaks.com/topic/302595-php-mysql-query-help/#findComment-1539575 Share on other sites More sharing options...
benanamen Posted November 22, 2016 Share Posted November 22, 2016 Try this SELECT Count(ti.itemid) AS CountOfItemID, col.collectiondesc FROM tbl_items ti LEFT JOIN tbl_lu_categories cat ON ti.itemcategory = cat.itemcatid LEFT JOIN tbl_lu_collections col ON cat.collectionid = col.collectionid WHERE ti.retailproduct = 1 GROUP BY col.collectiondesc; Quote Link to comment https://forums.phpfreaks.com/topic/302595-php-mysql-query-help/#findComment-1539576 Share on other sites More sharing options...
fonecave Posted November 23, 2016 Author Share Posted November 23, 2016 Perfect thank you so much I think the main problem was case sensitivity but thanks for all your help Quote Link to comment https://forums.phpfreaks.com/topic/302595-php-mysql-query-help/#findComment-1539639 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.