Jump to content

Unknown Colum in Field List - But column DOES exist!


Recommended Posts

I've got this annoying issue that I hope somebody could help with.

 

QUERY:

SELECT DISTINCT archive_order_lines.status, archive_order_lines.quantity, arch_orders.payment_status, arch_orders.order_number

FROM arch_orders as orders, archive_order_lines as order_lines

WHERE arch_orders.order_number=archive_order_lines.order_number

AND archive_order_lines.prod_code LIKE '%%'

AND (arch_orders.payment_datetime LIKE '%Jan 20 2010%')

ORDER BY arch_orders.order_number ASC

 

This produces the following error:

can't find order numbers Unknown column 'archive_order_lines.status' in 'field list'

 

All of the above fields are definitely present in the tables.

The error reported always shows the first part of the query i.e.

if i changed the first part of the query to:

SELECT DISTINCT archive_order_lines.quantity, archive_order_lines.status, ...

the resulting error would say:

can't find order numbers Unknown column 'archive_order_lines.quantity' in 'field list'

 

This query works correctly with other DB tables.

 

Any ideas why this does not work?

 

(sorry, I'm not sure what version of MySQL is installed on the server)

 

Hi

 

You have given the table alias names but then referred to the columns using the table names rather than the alias names, which seems a bit odd (never tried it but would assume it would cause this kind of issue).

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.