Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Unknown column in field list

Avatar of BenthamLtd
BenthamLtd asked on
10 Comments1 Solution828 ViewsLast Modified:
Yet again, this is probably something easy that I've completely overlooked so here it is.

In a nutshell, this is an extract of a search query on my system. Works brilliantly, apart from one of the joins/selects. Every time I run it, always returns "Unknown column 'dd_gar_how_returned.GARHowReturned' in 'field list' ".

Here is the query extract in full:

        sheets.Sheet_No AS Sheet_No,
        sheets.Sales_Ledger_No AS Sales_Ledger_No,
        sheets.CreationDateTime AS CreationDateTime,
        sheets.LatestModification AS LatestModification,
        sheets.LoggedBy AS LoggedBy,
        sheets.CompanyName AS CompanyName,
        sheets.ContactName AS ContactName,
        sheets.Postcode AS Postcode,
        sheets.Email AS Email,
        sheets.Phone AS Phone,
        sheets.InvoiceDate AS InvoiceDate,  
        goods_actually_returned.GoodsActuallyReturned AS GoodsActuallyReturned,
        goods_actually_returned.GoodsActuallyReturned_qty AS GoodsToBeSentOnReceipt_qty,
        dd_gar_quality.GARQuality AS GoodsActuallyReturned_quality,
        dd_gar_type.GARType AS GoodsActuallyReturned_type,
        dd_gar_supplier.GARSupplier AS GoodsActuallyReturned_supplier,
        dd_gar_how_returned.GARHowReturned AS HowReturned,
        consignment_no.ConsignmentNo AS ConsignmentNo

FROM sheets

LEFT JOIN goods_actually_returned ON sheets.Sheet_No = goods_actually_returned.Sheet_No

LEFT JOIN dd_gar_quality ON goods_actually_returned.GoodsActuallyReturned_quality = dd_gar_quality.GARQualityID

LEFT JOIN dd_gar_type ON goods_actually_returned.GoodsActuallyReturned_type = dd_gar_type.GARTypeID

LEFT JOIN dd_gar_supplier ON goods_actually_returned.GoodsActuallyReturned_supplier = dd_gar_supplier.GARSupplierID

LEFT JOIN dd_gar_how_returned ON dd_gar_how_returned.GARHowReturnedID = how_returned.HowReturned

LEFT JOIN consignment_no ON sheets.Sheet_No = consignment_no.Sheet_No 


sheets.Sheet_No = goods_actually_returned.Sheet_No 

AND dd_gar_how_returned.GARHowReturned LIKE 'Post (Royal Mail)';

Here is explain on the ref tables for 'dd_gar_how_returned' and 'how_returned':

/* how_returned */
| Field       | Type    | Null | Key | Default | Extra |
| Sheet_No    | int(11) | NO   |     | NULL    |       | 
| HowReturned | int(11) | YES  |     | NULL    |       | 

Example data - 
Sheet_No: 11123, HowReturned: 1
Sheet_No 11124, HowReturned: 2

/* dd_gar_how_returned */
| Field            | Type        | Null | Key | Default | Extra          |
| GARHowReturnedID | int(11)     | NO   | PRI | NULL    | auto_increment | 
| GARHowReturned   | varchar(50) | YES  |     | NULL    |                | 

Example data - 
GARHowReturnedID: 1, GARHowReturned: Post (Royal Mail)
GARHowReturnedID: 2, GARHowReturned: Courier

Any ideas, peeps?

Many thanks as always
Avatar of BenthamLtd

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers