You are not logged in.

#1 2008-09-12 20:02:48

addox
Member
From: Leeds, UK
Registered: 2008-08-06
Posts: 6

SQL Query

Does anyone know if it's possible to use a column you've selected in other functions in your select statement? I am using the following query at the minute:

select title, ifnull(filtered,title) as filtered_title, left(ifnull(filtered,title),1) as first_char, count(*) as count from movie as m left join movie_filtered as mf on m.id=mf.id group by left(ifnull(filtered,title),1)

I was hoping to use the `filtered_title` column value in the group by parameter and also to the left function. Any ideas would be fantastic.

Offline

#2 2008-09-13 09:04:58

avoulk
Member
From: Greece
Registered: 2007-08-28
Posts: 132
Website

Re: SQL Query

Why don't you just create a new variable containing the filtered_title column value, before this statement?

Offline

Board footer

Powered by FluxBB