So tired solving this problem, Help please
This is my table for messages

I'm trying to pull data from only mid no 1 and mid no 4, basically my goal is to get the last message from every sender
First i created a query to pull all the message for a user, in this case receiver id is 1
<cfquery name="messages_tb" datasource="appdb">
SELECT * FROM messages
WHERE receiver = <cfqueryparam value="1" cfsqltype="cf_sql_integer">
</cfquery>
then i created a list of every sender id
<cfset list.messages_tb_sender_uid = ValueList(messages_tb.sender)>
after that i did this
<cfquery name="messages_tb" datasource="appdb">
SELECT MAX(mid) as last_id from messages
WHERE sender IN ( <cfqueryparam value="#list.messages_tb_sender_uid#" cfsqltype="cf_sql_varchar" list="yes">)
and receiver = <cfqueryparam value="1" cfsqltype="cf_sql_integer">
</cfquery>
<cfset list.messages_tb_last = ValueList(messages_tb.last_id)>
<cfoutput>
#list.messages_tb_last#
</cfoutput>
The problem is im getting only 1 row, i dont wanna use loop or output query. Is there any way to just create a list of last mid of every sender ?
