Keyword

SQL Query to rebuild item url link?

More
6 years 6 months ago - 6 years 6 months ago #164366 by John
Hi,

While building an API I'm trying to join in SQL the 'category id' parents to one string as to recreate the url of the item.
Right now I have gone that far:
SELECT
	k2_items.id,
	k2_categories.`name` AS category,
	k2_categories.id AS catid,
	k2_items.alias,
	k2_items.title,
	k2_items.publish_up AS date,
	k2_items.`fulltext`,
	k2_categories.parent,
	k2_items.introtext 
FROM
	k2_categories
	INNER JOIN k2_items ON k2_categories.id = k2_items.catid
WHERE
	k2_items.published = 1 
	k2_items.publish_up >= NOW( ) 
	AND k2_items.trash = 0 
ORDER BY
	date ASC 
	LIMIT 0,
	10
Can you please suggest on what to change as to get a field with "category alias / parent alias / parent alias" etc..?

Many Thanks,
John
Last edit: 6 years 6 months ago by John.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum