- Posts: 12
- Thank you received: 0
MIN - MAX DB Query
- Michael
- Topic Author
- Offline
- New Member
-
Less
More
5 years 11 months ago #125297
by Michael
MIN - MAX DB Query was created by Michael
- Tuan Pham Ngoc
- Offline
- Administrator
-
5 years 11 months ago #125298
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic MIN - MAX DB Query
Hi
You can try to use the code below(PHP code)
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('MAX(membership_id) AS max_membership_id')
->select('MIN(membership_id) AS min_membership_id')
->from('#__osmembership_subscribers');
$db->setQuery($query);
$row = $db->loadObject();
echo $row->max_membership_id;
echo $row->min_membership_id;
If it's SQL, just use SELECT MAX(membership_id), MIN(membership_id) FROM #__osmembership_subscribers
(#__osmembership_subscribers needs to be replaced with correct table name, depends on database prefix on your site)
Tuan
You can try to use the code below(PHP code)
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('MAX(membership_id) AS max_membership_id')
->select('MIN(membership_id) AS min_membership_id')
->from('#__osmembership_subscribers');
$db->setQuery($query);
$row = $db->loadObject();
echo $row->max_membership_id;
echo $row->min_membership_id;
If it's SQL, just use SELECT MAX(membership_id), MIN(membership_id) FROM #__osmembership_subscribers
(#__osmembership_subscribers needs to be replaced with correct table name, depends on database prefix on your site)
Tuan
Please Log in or Create an account to join the conversation.
- Michael
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
5 years 11 months ago - 5 years 11 months ago #125299
by Michael
Replied by Michael on topic MIN - MAX DB Query
Thanks so much Tuan... Worked perfectly ... Michael
Last edit: 5 years 11 months ago by Michael.
Please Log in or Create an account to join the conversation.
- Michael
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
5 years 11 months ago #125320
by Michael
Replied by Michael on topic MIN - MAX DB Query
Hi Tuan,
I have a slightly tricker one this time.
Is it possible to create a button that exports a .xlsx spreadsheet of all member numbers between min and max that are not used??
Kind regards,
Michael
I have a slightly tricker one this time.
Is it possible to create a button that exports a .xlsx spreadsheet of all member numbers between min and max that are not used??
Kind regards,
Michael
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
5 years 11 months ago #125325
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic MIN - MAX DB Query
Hi Michael
It's unfortunately, this is not something we can guide you. For this, you will have to hire a developer to write code to develop that feature for you. It's not something quick and easy which we can guide you
Tuan
It's unfortunately, this is not something we can guide you. For this, you will have to hire a developer to write code to develop that feature for you. It's not something quick and easy which we can guide you
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.