- Posts: 1
- Thank you received: 0
Hi again,
Yes, my database allows "createview" using phpMyAdmin. The only problem now is that I have no idea what script to use to write the query. Do you have any suggestions on what to write to select newest record for a given category?
Thanks in advance!!
Kindly,
TC
Please Log in or Create an account to join the conversation.
Hi,
Here is an example how I did it for the case of joomla articles table (jos_content).
Unfortunately mysql does not support a subselect in 'from' clause at creating a view. This is why we need to create two views. First one selects the last date and the category for each category.
CREATE VIEW mxHelpView AS
SELECT catid, MAX(created) AS LastDate
FROM jos_content
GROUP BY catid
CREATE VIEW LatestArticles AS SELECT jos_content . *
FROM jos_content
INNER JOIN myHelpView ON myHelpView.catid = jos_content.catid
AND myHelpView.LastDate = jos_content.created
Please Log in or Create an account to join the conversation.
Hi Tomaž,
I just wanted to say thank you! It took me a little while to fully understand the commands versus fields in mySQL, but I got it. It works like a champ. Thanks to you I now can apply my new found knowledge to some other grids. I appreciate you sticky with me and not throwing me to the wolves.
GREAT PRODUCT AND GREAT SUPPORT!
Kind Regards,
TC
Please Log in or Create an account to join the conversation.
You are always welcome.
Best Regards!
Tomaž
Please Log in or Create an account to join the conversation.