That is indeed non standard sql as your grouping is inconsistent
This Sybase extension is to allow an easy join of an aggregate value to the rest of your data
In your select statement the where clause only apply to the MIN() function
An equivalent to your query using standard sql will be
Code:
select a.PR_ID, b.EMAIL_SEQ_ID, a.EMAIL_ID
from EMAIL a
,(select MIN(EMAIL_SEQ_ID) As EMAIL_SEQ_ID
from EMAIL
WHERE CHAR_LENGTH(Ltrim(rtrim(EMAIL_ID))) IS NOT NULL
and PR_ID between 1 and 2) b
I think you'll have to group by PR_ID and decide which EMAIL_ID you want min or max or do you want the one corosponding to the min(EMAIL_SEQ_ID)
Post some sample data and the expected output
AND your modified sql query if you still have a problem.