Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issues with table join

Status
Not open for further replies.

wbower34

IS-IT--Management
Dec 29, 2018
4
US
I am trying to extract two columns from table a and would like to join to table b to pull data where the abbrname (abbreviated name)is equal and the status field in table b is equal to A.

However, when I try this Postgres acts like it does not know how to reference the table data in the schema ( in the Postgres database). If I select everything with no criteria, the query runs fine. Below is the working query.

select *
from "Naturalisthrs".naturalist_members
full outer join "Naturalisthrs".naturalisttimesheet
on nmember = abbrname

Here is the query looking for the first two columns of table A, and the error received.

select Fname, Lname
from "Naturalisthrs".naturalist_members
full outer join "Naturalisthrs".naturalisttimesheet
on nmember = abbrname


ERROR: column "fname" does not exist
LINE 1: select Fname, Lname
^
HINT: Perhaps you meant to reference the column "naturalist_members.Fname" or the column "naturalist_members.Lname".
SQL state: 42703
Character: 8


Postgres is throwing me a curve as a new user to this database. Any guidance for a novice would be appreciated.

PgAdmin 3.6
Postgres 9.6
Mac OsX 10.11.6
 
Hi

wbower34 said:
Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other.
( PostgreSQL Documentation | The SQL Language | SQL Syntax | Lexical Structure | Identifiers and Key Words )
Code:
[b]select[/b] [i][green][highlight]"[/highlight]Fname[highlight]"[/highlight][/green][/i][teal],[/teal] [i][green][highlight]"[/highlight]Lname[highlight]"[/highlight][/green][/i]
[b]from[/b] [i][green]"Naturalisthrs"[/green][/i][teal].[/teal]naturalist_members
full [b]outer join[/b] [i][green]"Naturalisthrs"[/green][/i][teal].[/teal]naturalisttimesheet
[b]on[/b] nmember [teal]=[/teal] abbrname


Feherke.
feherke.github.io
 
Thank you, Feherke that solved what i was missing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top