Postgresql missing FROM-entry for table [closed] - sql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have 2 tables
messages
respondents
and I'm trying to join them using a simple inner join query
SELECT
Message.content,
Message.created_at,
Respondent.name
FROM
MESSAGES
INNER JOIN RESPONDENTS ON Message.respondent_id = Respondent.id;
and I'm getting this error:
ERROR: missing FROM-clause entry for table "message"
LINE 1: ...dent.name FROM MESSAGES INNER JOIN RESPONDENTS ON Message.re...
Can anyone help me out??

There are two typos in your query. Try this - assuming your tables are called respondents and messages:
SELECT
messages.content, messages.created_at, respondents.name
FROM messages
INNER JOIN respondents ON messages.respondent_id = respondents.id;

Related

How to do join using select [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 days ago.
This post was edited and submitted for review 2 days ago.
Improve this question
SQL Newbie here ...
Service_plan table has a record per customer with PKEY service_plan_id
SERVICE_PLAN_ID table keeps track of version changes with same PKEY
When I run this query [other selects omitted for brevity] in Oracle 10.2.0 iSQL command line, I get an error:
select S1.service_plan_id as TN,V1.VERSION_ID as Version
from Service_plan S1
inner join
(select distinct service_plan_id, max(VERSION_ID)
from SERVICE_PLAN_VERSION
where service_ID='COLL'
group by service_plan_id) as V1
on V1.SERVICE_PLAN_ID = S1.SERVICE_PLAN_ID
where S1.SERVICE_ID='COLL';
Error: missing key word on the "group by service_plan_id) as V1" line - it points to the "as" as the problem.
Any thoughts? Thx
Tried the standalone select and it works fine

ORA-00923 from keyword not found when trying to do a join [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When I previously ran this code for a join:
SELECT
Outlet.Address, Outlet.ManagerNumber,
Department.DepartmentName, Department.FloorArea
FROM
Outlet
INNER JOIN
Department ON Outlet.OutletNumber = Department.OutletNumber;
It worked. However, I am trying to run a similar join it simply does not work:
SELECT
Product.Description Product.Price,
ProductAtOutlet.Quantity,
ProductAtOutlet.OutletNumber
FROM
Product
INNER JOIN
ProductAtOutlet ON Product.ProductNumber = ProductAtOutlet.ProductNumber;
And I keep getting the error message
ORA-00923 from keyword not found
missing comma, after description?
SELECT
Product.Description,
Product.Price,
ProductAtOutlet.Quantity,
ProductAtOutlet.OutletNumber
FROM
Product
INNER JOIN ProductAtOutlet ON Product.ProductNumber = ProductAtOutlet.ProductNumber;
The problem is that you are missing a comma after Product.Description. This causes the parser to see Product.Price as a column alias. Having a . in an unquoted alias results in a parser error.

Can somebody suggest me what is wrong with this query? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
select met.metno , eps.sn , el.ed
from el
inner join met on eps.sn=met.sn
inner join eps
on el.epid=eps.epid
where el.etid=1002
and el.ed>'2017-01-03'
and el.ed<'2018-07-05'
You have an additional inner join after the where clause. Do the joins first (FROM) then the WHERE

SQL Join operation error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am trying to write an SQL code in MS Access 2010 as follows:-
select WOWPerformanceData_tbl.Style,
WOWPerformanceData_tbl.FY,
WOWPerformanceData_tbl.Month,
PrintPromotions.[Type of Offer],
PrintPromotions.Start,
PrintPromotions.End
from WOWPerformanceData_tbl
right join PrintPromtions
on WOWPerformanceData_tbl.Style=PrintPromotions.Style
where (WOWPerformanceData_tbl.Style=[Enter Style nr:]);
Upon running the code, Access returns an error in the join operation pointing to the fourth line and selects PrintPromotions
Any feedback will be appreciated..
Thank you.
Should that be PrintPromotions and not PrintPromtions ?
This is fine as the where clause is an evaluation on the entire set.
SELECT WOWPerformanceData_tbl.Style,
WOWPerformanceData_tbl.FY,
WOWPerformanceData_tbl.Month,
PrintPromotions.[Type of Offer],
PrintPromotions.Start,
PrintPromotions.End
from WOWPerformanceData_tbl
LEFT join PrintPromtions
on WOWPerformanceData_tbl.Style=PrintPromotions.Style
where (WOWPerformanceData_tbl.Style=[Enter Style nr:]);
This would exclude records from printPromotions that were not in wowPerformanceData_tbl, which negates the right join.:
SELECT WOWPerformanceData_tbl.Style,
WOWPerformanceData_tbl.FY,
WOWPerformanceData_tbl.Month,
PrintPromotions.[Type of Offer],
PrintPromotions.Start,
PrintPromotions.End
from WOWPerformanceData_tbl
right join PrintPromtions
on WOWPerformanceData_tbl.Style=PrintPromotions.Style
where (WOWPerformanceData_tbl.Style=[Enter Style nr:]);
This is how you would do it to keep all records from PrintPromotions and those that matched in wowperofrmanceData_tbl.
SELECT WOWPerformanceData_tbl.Style,
WOWPerformanceData_tbl.FY,
WOWPerformanceData_tbl.Month,
PrintPromotions.[Type of Offer],
PrintPromotions.Start,
PrintPromotions.End
from WOWPerformanceData_tbl
right join PrintPromtions
on WOWPerformanceData_tbl.Style=PrintPromotions.Style
AND (WOWPerformanceData_tbl.Style=[Enter Style nr:]);

Incorrect syntax near '.\'. in sql [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
When I ran the query I am getting incorrect syntax error. can any one help me to fix it?
SELECT
si.SoftwareImage as ImagePLName,
SUBSTRING(si.SoftwareImage, 0, CHARINDEX(\'.\',si.SoftwareImage)),
sib.SoftwareImageBuild as BuildID
FROM
v000001.SoftwareProductBuilds spb
JOIN
v000001.SoftwareProductBuildSoftwareImageBuilds spbisib ON spbisib.SoftwareProductBuildId = spb.SoftwareProductBuildId
JOIN
v000001.SoftwareImageBuilds sib ON sib.SoftwareImageBuildId = spbisib.SoftwareImageBuildId
JOIN
v000001.SoftwareImages si ON si.SoftwareImageId = sib.SoftwareImageId
WHERE
spb.SoftwareProductBuild = '123456'
It should be:
CHARINDEX('.\',si.SoftwareImage)
Documentation to CHARINDEX for SQL Server
Documentation to CHARINDEX for Sybase.