|
Posted by phillip.s.powell@gmail.com on September 18, 2006, 1:32 pm
Please log in for more thread options
[quote]
SELECT
IF(image_location_country IS NULL OR image_location_country = '', 'x',
NULL) AS image_location_country_alt,
image_path
FROM image
WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
ORDER BY upper(image_location_country_alt) desc,
upper(image_location_country) DESC,
upper(image_location_state) DESC,
upper(image_location_city) DESC,
upper(image_name) DESC,
upper(right(image_name, 2)) DESC
LIMIT 1
[/quote]
This query produces the following error:
[quote]
Unknown column 'image_location_country_alt' in 'order clause' using
query
[/quote]
I'm sorry but I must have this "column" in the query, it's vital for
required sorting order (you have to sort image_location_country in
alphanumeric order, however, that column can also be null, BUT all
NON-NULL fields MUST BE FIRST before all NULL fields!)
I'm not sure what's happening, please help!
Thanx
Phil
|
|
Posted by strawberry on September 18, 2006, 1:43 pm
Please log in for more thread options
phillip.s.powell@gmail.com wrote:
> [quote]
> SELECT
> IF(image_location_country IS NULL OR image_location_country = '', 'x',
> NULL) AS image_location_country_alt,
> image_path
>
> FROM image
>
> WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
>
> ORDER BY upper(image_location_country_alt) desc,
> upper(image_location_country) DESC,
> upper(image_location_state) DESC,
> upper(image_location_city) DESC,
> upper(image_name) DESC,
> upper(right(image_name, 2)) DESC
>
> LIMIT 1
> [/quote]
>
> This query produces the following error:
>
> [quote]
> Unknown column 'image_location_country_alt' in 'order clause' using
> query
> [/quote]
>
> I'm sorry but I must have this "column" in the query, it's vital for
> required sorting order (you have to sort image_location_country in
> alphanumeric order, however, that column can also be null, BUT all
> NON-NULL fields MUST BE FIRST before all NULL fields!)
>
> I'm not sure what's happening, please help!
>
> Thanx
> Phil
Not quite sure what's going on here, but does this work:
SELECT image_path, IF(image_location_country IS NULL OR
image_location_country ='', '1', 0) AS isnull
FROM image
WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
ORDER BY isnull ASC,
upper(image_location_country) DESC,
upper(image_location_state) DESC,
upper(image_location_city) DESC,
upper(image_name) DESC,
upper(right(image_name, 2)) DESC
LIMIT 1
|
|
Posted by phillip.s.powell@gmail.com on September 18, 2006, 2:16 pm
Please log in for more thread options
strawberry wrote:
> phillip.s.powell@gmail.com wrote:
> > [quote]
> > SELECT
> > IF(image_location_country IS NULL OR image_location_country = '', 'x',
> > NULL) AS image_location_country_alt,
> > image_path
> >
> > FROM image
> >
> > WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> >
> > ORDER BY upper(image_location_country_alt) desc,
> > upper(image_location_country) DESC,
> > upper(image_location_state) DESC,
> > upper(image_location_city) DESC,
> > upper(image_name) DESC,
> > upper(right(image_name, 2)) DESC
> >
> > LIMIT 1
> > [/quote]
> >
> > This query produces the following error:
> >
> > [quote]
> > Unknown column 'image_location_country_alt' in 'order clause' using
> > query
> > [/quote]
> >
> > I'm sorry but I must have this "column" in the query, it's vital for
> > required sorting order (you have to sort image_location_country in
> > alphanumeric order, however, that column can also be null, BUT all
> > NON-NULL fields MUST BE FIRST before all NULL fields!)
> >
> > I'm not sure what's happening, please help!
> >
> > Thanx
> > Phil
>
> Not quite sure what's going on here, but does this work:
>
> SELECT image_path, IF(image_location_country IS NULL OR
> image_location_country ='', '1', 0) AS isnull
> FROM image
> WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> ORDER BY isnull ASC,
> upper(image_location_country) DESC,
> upper(image_location_state) DESC,
> upper(image_location_city) DESC,
> upper(image_name) DESC,
> upper(right(image_name, 2)) DESC
> LIMIT 1
No it doesn't "unknown column "isnull""
Phil
|
|
Posted by strawberry on September 18, 2006, 3:44 pm
Please log in for more thread options
phillip.s.powell@gmail.com wrote:
> strawberry wrote:
> > phillip.s.powell@gmail.com wrote:
> > > [quote]
> > > SELECT
> > > IF(image_location_country IS NULL OR image_location_country = '', 'x',
> > > NULL) AS image_location_country_alt,
> > > image_path
> > >
> > > FROM image
> > >
> > > WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> > >
> > > ORDER BY upper(image_location_country_alt) desc,
> > > upper(image_location_country) DESC,
> > > upper(image_location_state) DESC,
> > > upper(image_location_city) DESC,
> > > upper(image_name) DESC,
> > > upper(right(image_name, 2)) DESC
> > >
> > > LIMIT 1
> > > [/quote]
> > >
> > > This query produces the following error:
> > >
> > > [quote]
> > > Unknown column 'image_location_country_alt' in 'order clause' using
> > > query
> > > [/quote]
> > >
> > > I'm sorry but I must have this "column" in the query, it's vital for
> > > required sorting order (you have to sort image_location_country in
> > > alphanumeric order, however, that column can also be null, BUT all
> > > NON-NULL fields MUST BE FIRST before all NULL fields!)
> > >
> > > I'm not sure what's happening, please help!
> > >
> > > Thanx
> > > Phil
> >
> > Not quite sure what's going on here, but does this work:
> >
> > SELECT image_path, IF(image_location_country IS NULL OR
> > image_location_country ='', '1', 0) AS isnull
> > FROM image
> > WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> > ORDER BY isnull ASC,
> > upper(image_location_country) DESC,
> > upper(image_location_state) DESC,
> > upper(image_location_city) DESC,
> > upper(image_name) DESC,
> > upper(right(image_name, 2)) DESC
> > LIMIT 1
>
> No it doesn't "unknown column "isnull""
>
> Phil
Can I just confirm that you're using mysql 4.1 or later?
|
|
Posted by phillip.s.powell@gmail.com on September 18, 2006, 3:56 pm
Please log in for more thread options
strawberry wrote:
> phillip.s.powell@gmail.com wrote:
> > strawberry wrote:
> > > phillip.s.powell@gmail.com wrote:
> > > > [quote]
> > > > SELECT
> > > > IF(image_location_country IS NULL OR image_location_country = '', 'x',
> > > > NULL) AS image_location_country_alt,
> > > > image_path
> > > >
> > > > FROM image
> > > >
> > > > WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> > > >
> > > > ORDER BY upper(image_location_country_alt) desc,
> > > > upper(image_location_country) DESC,
> > > > upper(image_location_state) DESC,
> > > > upper(image_location_city) DESC,
> > > > upper(image_name) DESC,
> > > > upper(right(image_name, 2)) DESC
> > > >
> > > > LIMIT 1
> > > > [/quote]
> > > >
> > > > This query produces the following error:
> > > >
> > > > [quote]
> > > > Unknown column 'image_location_country_alt' in 'order clause' using
> > > > query
> > > > [/quote]
> > > >
> > > > I'm sorry but I must have this "column" in the query, it's vital for
> > > > required sorting order (you have to sort image_location_country in
> > > > alphanumeric order, however, that column can also be null, BUT all
> > > > NON-NULL fields MUST BE FIRST before all NULL fields!)
> > > >
> > > > I'm not sure what's happening, please help!
> > > >
> > > > Thanx
> > > > Phil
> > >
> > > Not quite sure what's going on here, but does this work:
> > >
> > > SELECT image_path, IF(image_location_country IS NULL OR
> > > image_location_country ='', '1', 0) AS isnull
> > > FROM image
> > > WHERE image_path REGEXP '\/www\/html\/tools\/images\/myalbum/.+$'
> > > ORDER BY isnull ASC,
> > > upper(image_location_country) DESC,
> > > upper(image_location_state) DESC,
> > > upper(image_location_city) DESC,
> > > upper(image_name) DESC,
> > > upper(right(image_name, 2)) DESC
> > > LIMIT 1
> >
> > No it doesn't "unknown column "isnull""
> >
> > Phil
>
> Can I just confirm that you're using mysql 4.1 or later?
Yes, 4.1.20
|
| Similar Threads | Posted | | Add column if not exist | June 12, 2006, 9:05 pm |
| Unknown column 'NAN' in 'field list' | September 21, 2006, 3:31 pm |
| "Duplicate column name" error when adding column | January 12, 2006, 3:30 am |
| ORDER BY 5*(column LIKE ' term') + 4*(column LIKE ' term') | September 12, 2006, 9:54 am |
| Max of a column where ... | February 17, 2006, 11:49 am |
| copying a column | June 14, 2005, 6:56 am |
| auto column | December 30, 2005, 2:18 am |
| Incorrect Column Type!! | August 4, 2005, 11:05 am |
| how to delete content of column? | March 1, 2006, 4:21 am |
| Querying a column with brackets in its name | March 15, 2006, 11:30 pm |
|