Skip to content

Instantly share code, notes, and snippets.

@olivermt olivermt/query.sql
Created Mar 7, 2017

Embed
What would you like to do?
[42P01] ERROR: invalid reference to FROM-clause entry for table "locations" Hint: Perhaps you meant to reference the table alias "location".
select
operations.legal_name as legal_name,
operations.operation_name as organization_name,
operations.general_description as general_description,
operations.is_exempt as is_exempt,
operations.does_export,
operations.phone,
operations.url,
operations.year_started,
operations.employees,
operations.contact_2_name,
operations.contact_2_phone,
operations.overseer_name,
operations.non_organic_production_description,
location.name,
location.address_text,
location.address,
location.city,
location.state,
location.postal,
location.country,
location.data,
billing_location.name,
billing_location.address_text,
billing_location.address,
billing_location.city,
billing_location.state,
billing_location.postal,
billing_location.country,
billing_location.data,
legal_location.name,
legal_location.address_text,
legal_location.address,
legal_location.city,
legal_location.state,
legal_location.postal,
legal_location.country,
legal_location.data,
users.id as user_id
from operations
LEFT JOIN users ON users.id = operations.user
LEFT JOIN locations as location ON operations.location = locations.id
LEFT JOIN locations as billing_location ON operations.billing_location = locations.id
LEFT JOIN locations as legal_location ON operations.legal_location = locations.id
WHERE operations.aca = 10110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.