Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: Show the complete query. Take the error message as correct, you are specifying 'companies as c' more then once. Adrian, I saw that but didn't know how to specify the alias only one time. Thanks, Rich

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Ray O'Donnell wrote: Look again at Shammat's example! - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p   LEFT JOIN companies as c ON c.company_nbr = p.company_nbr NB - "... from people as p left join companies as c on " -

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: The query needs to be: SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Only reference companies as c once. Thanks, Adrian. I mis-read your origi

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
On 2024-05-18 17:12 +0200, David G. Johnston wrote: > Too lazy to find the docs right now but what you are observing is basically > an operator precedence effect. The comma join hasn’t happened at the time > the left join is evaluated and so other tables in the comma join cannot > appear in the on

Re: Left join syntax error

2024-05-18 Thread David G. Johnston
On Sat, May 18, 2024 at 7:49 AM Adrian Klaver wrote: > On 5/18/24 07:46, Rich Shepard wrote: > > On Sat, 18 May 2024, Shammat wrote: > > > >> Don't put the second table in the FROM part > >> > >> SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > >> c.company_name > >> FROM people as

Re: utf8 vs UTF-8

2024-05-18 Thread Tom Lane
Adrian Klaver writes: > On 5/18/24 07:48, Troels Arvin wrote: >> Also, when I try to create a database with "en_US.utf8" as locale >> without specifying a template: >> >> troels=# create database test4 locale 'en_US.utf8'; >> ERROR:  new collation (en_US.utf8) is incompatible with the collation

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Erik Wienhold wrote: Yes, Rich probably just wants the left join. Eric, You're correct: I want certain colums from the people table with their company name from the companies table. But I wonder if the implicit cross join syntax ("FROM peoples, companies") should actual

Re: Left join syntax error

2024-05-18 Thread Tom Lane
Erik Wienhold writes: > But I wonder if the implicit cross join syntax ("FROM peoples, companies") > should actually produce this error because the explicit cross join > works: > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > c.company_name > FROM people as p > C

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
I wrote: > But I wonder if the implicit cross join syntax ("FROM peoples, companies") > should actually produce this error because the explicit cross join > works: > > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > c.company_name > FROM people as p > CROSS JOIN co

Re: Left join syntax error

2024-05-18 Thread David G. Johnston
On Saturday, May 18, 2024, Erik Wienhold wrote: > On 2024-05-18 15:19 +0200, Shammat wrote: > > Am 18.05.24 um 14:52 schrieb Rich Shepard: > > > It's been a _very_ long time since I wrote a SQL script and, despite > looking > > > at my SQL books and web pages, I don't know how to fix the error. >

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 08:04, Rich Shepard wrote: On Sat, 18 May 2024, Adrian Klaver wrote: ... LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Adrian, Tried that: bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR:  table name "c" specified more than once Show the c

Re: Left join syntax error

2024-05-18 Thread Ray O'Donnell
On 18/05/2024 16:01, Rich Shepard wrote: On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: ... LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Adrian, Tried that: bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR: table name "c" specified more than once Thanks, Rich

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 08:01, Rich Shepard wrote: On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON c.c

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR: tab

Re: utf8 vs UTF-8

2024-05-18 Thread Adrian Klaver
On 5/18/24 07:48, Troels Arvin wrote: Hello, Tom Lane wrote: >>  test1  | loc_test | UTF8   | libc | en_US.UTF-8 | en_US.UTF-8 >>  test3  | troels   | UTF8   | libc | en_US.utf8  | en_US.utf8 > > On most if not all platforms, both those spellings of the locale names > will be taken

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
On 2024-05-18 15:19 +0200, Shammat wrote: > Am 18.05.24 um 14:52 schrieb Rich Shepard: > > It's been a _very_ long time since I wrote a SQL script and, despite looking > > at my SQL books and web pages, I don't know how to fix the error. > > > > The three line script is: > > - > > SELECT p.lna

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 07:46, Rich Shepard wrote: On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p  LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I tried t

Re: Left join syntax error

2024-05-18 Thread Ray O'Donnell
On 18/05/2024 15:46, Rich Shepard wrote: On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p  LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I trie

Re: utf8 vs UTF-8

2024-05-18 Thread Troels Arvin
Hello, Tom Lane wrote: >>  test1  | loc_test | UTF8   | libc | en_US.UTF-8 | en_US.UTF-8 >>  test3  | troels   | UTF8   | libc | en_US.utf8  | en_US.utf8 > > On most if not all platforms, both those spellings of the locale names > will be taken as valid.  You might try running "locale -a"

Re: Valid until

2024-05-18 Thread Adrian Klaver
On 5/18/24 03:09, Rama Krishnan wrote: Reply to list also. Ccing list Hi Adrian, I have modified the pg_hba entry from trust to md5 like below ``` local   all             all                                     md5 That would be the issue. trust ignores the password check. ``` When i ha

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I tried this with this result: ERROR: missing FR

Re: Valid until

2024-05-18 Thread Adrian Klaver
On 5/18/24 02:37, Rama Krishnan wrote: Reply to list also. Ccing list. Please find the details below ``` postgres=# \du                               List of roles  Role name  |                         Attributes +  p

Re: utf8 vs UTF-8

2024-05-18 Thread Troels Arvin
Hellok Hans Schou wrote:   > test3   | troels   | UTF8 | libc | en_US.utf8 |  en_US.utf8 [...]   how did you create test3? For this example, I used specified it at creation time: CREATE DATABASE test3 TEMPLATE template0 LOCALE 'en_US.utf8'; In the real-world example I'm working wit

Re: Left join syntax error

2024-05-18 Thread Shammat
Am 18.05.24 um 14:52 schrieb Rich Shepard: It's been a _very_ long time since I wrote a SQL script and, despite looking at my SQL books and web pages, I don't know how to fix the error. The three line script is: - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name

Left join syntax error

2024-05-18 Thread Rich Shepard
It's been a _very_ long time since I wrote a SQL script and, despite looking at my SQL books and web pages, I don't know how to fix the error. The three line script is: - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p, companies as c LEFT JOIN