> > Thanks,
> > but I want wo JOIN data from three tables and then to order
> > all data by "datestamp".

There must be more than one column called datestamp, this is why mysql is
telling you it's ambiguous.
So you need to tell it which table's datestamp column you wish to use.
for example your new query could be:

select * from f1,f2,f3 order by f1.datestamp

Also, presumably all the tables have a column which relates to one of the
other columns in some way?

If so, and I can't reason the point in doing it if there is not, maybe you
should look at the JOIN syntax from the mysql manual. If nothing else it
will give you a better understanding of joining tables and the problems you
may face.

M:

> > Can I Do It ?
> >
> > Thanks,
> > Rosen
> >
> >
> >
> > Andrey Hristov wrote in message
> <071401c17759$f5873c80$0b01a8c0@ANDreY>...
> >
> >> Mysql says that in the join there are some columns with namer
> datestamp so
> >
> > you have to choose by which you want to order.
> >
> >> Think about making LEFT JOIN.
> >> select * from f1 LEFT JOIN f2 ON f1.some_field=f2.some_field
> LEFT JOIN f3
> >
> > ON f2.some_field=f3.some_field roder by f1.datestamp;
> >
> >> Regards,
> >> Andrey Hristov
> >> IcyGEN Corporation
> >> http://www.icygen.com
> >> BALANCED SOLUTIONS
> >>
> >>
> >> ----- Original Message -----
> >> From: "Rosen" <[EMAIL PROTECTED]>
> >> To: <[EMAIL PROTECTED]>
> >> Sent: Tuesday, November 27, 2001 5:34 PM
> >> Subject: [PHP-DB] Problem with SQL query on several tables
> >>
> >>
> >>> Hi,
> >>> I'm trying to execute SQL query:
> >>> "select * from f1,f2,f3 order by datestamp"
> >>>
> >>> MySQL returns me an error:
> >>> "1052 - Column: 'datestamp' in order clause is ambigious"
> >>>
> >>> The tables f1,f2,f3 have some structure.
> >>> The field "datestamp" is type datetime.
> >>>
> >>> Why I can't order query on 'datestamp' ?
> >>>
> >>> Thanks,
> >>> Rosen
> >>>
> >>>
> >>>
> >>> --
> >>> PHP Database Mailing List (http://www.php.net/)
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> >>>
> >>>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to