0

As the title suggests, I have no clue why this doesn't work. If someone can point out what I am doing wrong it would be sweet.

Here's the current table rows and cols:

Makes table:

 id |     make      
----+---------------
  1 | Acura

Models Table:

 id  |              model              | makesId 
-----+---------------------------------+---------
   1 | CL                              |       1
   2 | ILX                             |       1
   3 | Integra                         |       1
   4 | Legend                          |       1
   5 | MDX                             |       1
   6 | NSX                             |       1
   7 | RDX                             |       1
   8 | RL                              |       1
   9 | RLX                             |       1

I am trying to query from both tables using a simple line with the WHERE clause with the following query:

SELECT models.model, makes.make 
FROM models, makes 
WHERE models.makesId = makes.id;

funprojectdb=# SELECT models.model, makes.make FROM models, makes WHERE models.makesId = makes.id;

ERROR:  column models.makesid does not exist

LINE 1: ...models.model, makes.make FROM models, makes WHERE models.mak...
                                                         ^

HINT: Perhaps you meant to reference the column "models.makesId".

The goal is to basically show me all of the models associated to the makes id.

jhoangqm
  • 55
  • 2
  • 10

1 Answers1

0

Thanks to the people that answered my question.

It was an issue with postgres case sensitivity which I completely forgot about.

I will be re-doing the database columns with proper field names.

jhoangqm
  • 55
  • 2
  • 10
  • 1
    You could rephrase this to make it a proper answer - i.e. demonstrate (perhaps also with a fiddle) what is happening when you use quoted identifiers - you could also point people at [this page](https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_upper_case_table_or_column_names) - the bit about `Stick to using a-z, 0-9 and underscore for names and you never have to worry about quoting them`. – Vérace Jan 01 '23 at 10:19