Answered
Sort by Email Address
Hello,
I have an application that I want to sort by the email address URL ( everything right of the @ ) , but still want to display the full email address. There was a question similar to this but it was not answered in a format that I could use. I am using an Access Database.
My query is
<cfquery name="getEmails" dataSource="#application.db#">
SELECT email_ID, email_address
FROM email_out
ORDER by email_address
</cfquery>
I have tried the ListLast(email_address,"@") in the SQL statement but can not get it to work.
I have tried the ListLast(email_address,"@") in the query output which will print out the right part of the email address, but that is not quite what I want.
I want to have the query output all of the information but sort it by the text that is right of the @
i.e. janet@wpxdesign.com
jim@wpxdesign.com
wayne@wpxdesign.com
So basically if this did not throw an error this is what I would need -
<cfquery name="getEmails" dataSource="#application.db#">
SELECT email_ID, email_address
FROM email_out
ORDER by ListLast(email_address,"@")
</cfquery>
But this doesn't work I also tried the SELECT email_ID, ListLast(email_address,"@") as daEmail
but that didn't work either
Thanks in advance.
I have an application that I want to sort by the email address URL ( everything right of the @ ) , but still want to display the full email address. There was a question similar to this but it was not answered in a format that I could use. I am using an Access Database.
My query is
<cfquery name="getEmails" dataSource="#application.db#">
SELECT email_ID, email_address
FROM email_out
ORDER by email_address
</cfquery>
I have tried the ListLast(email_address,"@") in the SQL statement but can not get it to work.
I have tried the ListLast(email_address,"@") in the query output which will print out the right part of the email address, but that is not quite what I want.
I want to have the query output all of the information but sort it by the text that is right of the @
i.e. janet@wpxdesign.com
jim@wpxdesign.com
wayne@wpxdesign.com
So basically if this did not throw an error this is what I would need -
<cfquery name="getEmails" dataSource="#application.db#">
SELECT email_ID, email_address
FROM email_out
ORDER by ListLast(email_address,"@")
</cfquery>
But this doesn't work I also tried the SELECT email_ID, ListLast(email_address,"@") as daEmail
but that didn't work either
Thanks in advance.
