https://antibiotiqueaugmentin.com/surdosage-augmentin-bebe/

Need plugin to show record for specific category

More
12 years 10 months ago #1164

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.

More
12 years 10 months ago #1166

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

With the help of this view we select the whole records from the original table
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

Change the names of tables and fields according to you schema and use the above commands to create the views. As next step you use the second view to display it with Card View JX.

I hope it helps.

Regards,
Tomaž

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

More
12 years 10 months ago #1174

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.

More
12 years 10 months ago #1176

You are always welcome.

Best Regards!
Tomaž

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

Moderators: tomaz
Time to create page: 0.162 seconds

Contact Us

Contact us on Discord

Contact us on Facebook