Mysql WordPress Query
-
[ Moderator note: moved to Developing with WordPress. ]
I have a query which counts the number of instances in a field and from this I can then display the results with the totals next them.
$alumniyears = $wpdb->get_results("SELECT
value, COUNT(*) as tot_year FROM
wp_bp_xprofile_dataWHERE
field_id=6 GROUP BY value", ARRAY_A);
|———-|———-|———-|
| 2001 (2) | 2002 (1) | 2003 (6) |
| 2004 (2) | 2005 (4) | 2006 (3) |
|———-|———-|———-|I now want to be able to display a single result which has the highest number of instances.
2003 (6)
What is the best way of doing this?
Many thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Mysql WordPress Query’ is closed to new replies.