Mira, he sacado esto del código que dejaste, y tendria que darte la pista:
Código PHP:
$query = ( SELECT
jg.id,
jg.catid,
jg.imgtitle,
jg.imgauthor,
jg.imgtext,
jg.hits,
jg.imgfilename,
jg.imgthumbname,
jg.owner AS imgowner,
jg.imgdate AS created,
@is_comment:=0 AS iscomment,
jgc.cid,
jgc.name,
jgc.description,
jgc.thumbnail,
jgc.catpath,
@cmtid as cmtid,
@cmtpic as cmtpic,
@cmttext as cmttext,
u.name AS uname,
u.username AS uusername
seguramente, lo que buscas es
Código PHP:
$clause = 'imgtitle ASC, jg.imgtext ASC';
Saludos