Ive been working on this one most of the day.
I finally got the Edit SQL query to work, but now I have an issue when selecting a list item for editing.
I have two tables, customers and purchases.
They both have a field called customer_id
I finally got the query below to work that would join the tables and retrieve all the fields needed.
select
`customer`.customer_id,
`customer`.name,
`customer`.contact_1,
`customer`.contact_2,
`customer`.email_1,
`customer`.created_date,
`customer`.address1,
`customer`.memo,
`customer`.address2,
`customer`.city_id,
`customer`.postal_zip_code,
`customer`.email_2,
`customer`.phone,
`customer`.fax,
`customer`.cell,
`customer`.other,
`customer`.status_id,
`customer`.tax1_exempt,
`customer`.tax2_exempt,
`customer`.tax3_exempt,
`customer`.discount_rate,
`customer`.discount_amount,
`customer`.www_url,
`customer`.industry_id,
`purchases`.desdate0,
`purchases`.date_0,
`purchases`.ddate_0
From `customer`
INNER JOIN purchases ON (`customer`.customer_id = `purchases`.customer_id)
WHERE (purchases.ddate_0 != 1)
I would like to add the sort order but I get an sql error when I add the piece below.
ORDER BY `purchases`.date_0 ASC
Without the ORDER BY, I do get a list correctly.
But when I select edit I get an error
Error description: Column: 'customer_id' in field list is ambiguous
Error file : localhost/yellowsheet/purchases_list.php?masterkey=4174
The purchases table, I have defined a master link to the customers in PHP runner.
I hope this is enough to show. I must be doing something wrong with my syntax or something, I hope.
Any suggestions.
Thankyou in advance.