I am need of some sql query help. I am looking to retrieve Names from a column as well as another piece of data in this same column. I am then wanting to combine these two values together and display that data (only show the recent 5 names). From my readings, I would be using a UNION ALL within the query ... I've played with the query but need some help to finish it and am hoping someone out there can assist me with that. I am also needing assistance for the echo statement which actually displays the information I want.
The WordPress site I have setup is an Alumni website and am using BuddyPress. The query above, I want the 5 recent members who have signed up to display in the sidebar along with their graduation year (ex: John Smith - 2002) I have a widget to scroll through the recent members but want to include their graduation year. Since I am using Buddypress, the member sign-up info gets stored in a different table.
Table info is saved: wp_bp_xprofile_data
Column with info I want: value
Here is what I have currently for the sql query:
$sql = 'SELECTvalue
. ' UNION ALL'
. ' SELECT