Re: Column 'movie_type_id' in order clause is ambiguous
| From: | cajbecu | Date: | Sun, 28 May 2006 11:17:29 +0000 |
| Subject: | Re: Column 'movie_type_id' in order clause is ambiguous | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237016@lists.php.net to get a copy of this message | ||
Hello,
Try ... ORDER BY
movie.movie_type_id;
Mark Sargent wrote:
> Hi All,
>
> I get this,
>
> Column 'movie_type_id' in order clause is ambiguous
>
> for this code,
>
> $query = "SELECT movie.movie_name, movietypes.movie_type_label FROM
> movie, movietypes WHERE movie.movie_type_id = movietypes.movie_type_id
> AND movie_year>1990 ORDER BY movie_type_id";
> $results=mysql_query($query) or die(mysql_error());
>
> and here is the table structure,
>
> mysql> SELECT * FROM movie;
>
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> | movie_id | movie_name | movie_type_id | movie_year |
> movie_lead_actor_id | movie_director_id |
>
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> | 1 | Bruce Almighty | 5 | 2003
> | 1 | 2 |
> | 2 | Office Space | 5 | 1999
> | 5 | 6 |
> | 3 | Grand Canyon | 2 | 1991
> | 4 | 3 |
>
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> 3 rows in set (0.00 sec)
>
> mysql> SELECT * FROM movietypes;
> +---------------+------------------+
> | movie_type_id | movie_type_label |
> +---------------+------------------+
> | 1 | Sci Fi |
> | 2 | Drama |
> | 3 | Adventure |
> | 4 | War |
> | 5 | Comedy |
> | 6 | Horror |
> | 7 | Action |
> | 8 | Kids |
> +---------------+------------------+
> 8 rows in set (0.00 sec)
>
> A Google search for the error gave nothing.
>
> Cheers.
>
> Mark Sargent.
>