Select SQL Category ID

More
11 years 5 months ago #43680 by igcorreia
Hello, is this the correct approach for the select field with QUERY?
Code:
SELECT DISTINCT id as value, title as text FROM #__content AS i JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id WHERE rel.catid= 146 AND i.state = 1

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

More
11 years 5 months ago #43698 by ggppdk
Replied by ggppdk on topic Select SQL Category ID
Hello

better use
'i.id' instead of 'id'
i.state IN (1, -5) instead of i.state = 1

and better move the
rel.catid= 146
in the JOIN !!
Code:
SELECT DISTINCT id as value, title as text FROM #__content AS i JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id AND rel.catid= 146 WHERE i.state IN (1, -5)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 5 months ago #43719 by igcorreia
Replied by igcorreia on topic Select SQL Category ID
Thanks :)

I asked because couldn't find the tutorial, I remembered that it existed before.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.569 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save