Jump to content

Recommended Posts

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.CollectionDesc
FROM (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.CollectionID
WHERE (((tbl_Items.RetailProduct)=-1))
GROUP BY tbl_LU_Collections.CollectionDesc;

Link to comment
https://forums.phpfreaks.com/topic/302595-php-mysql-query-help/
Share on other sites

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;
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.