Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Did you select the database?
EDIT: Maybe you didn't do a “USE database” before, so MariaDB takes sometable as a database name since there is no current database selected. -
The database is 'use'ed and the official docs (https://mariadb.com/kb/en/...) say "When specifying a column, you can either use just the column name or qualify the column name with the name of the table using tbl_name.col_name"
-
Okay I figured it out. You have to actually specify the table in the FROM list, i.e. `SELECT sometable.foobar FROM sometable;`
-
@12bitfloat wait so in some SQL databases
SELECT table.colum alone is allowed?
I've always thought that table.column is allowed to make reading join queries a lot easier or at least specifying from which table that column is to be fetched in-case same column name exist in multiple tables of the same join query -
C0D4681385yYou can specific table names or add alias' to your tables
@highlight
# join with full table names
SELECT table1.foo, table2.bar
FROM table1
JOIN table2 ON (table1.id = table2.fk)
WHERE table2.someDate = "2019-10-02"
# otherwise using an alias for tables
SELECT t1.foo, t2.bar
FROM table1 t1
JOIN table2 t2 ON (t1.id = t2.fk)
WHERE t2.someDate = "2019-10-02" -
@C0D4 That's actually what I normally do. Today at work I had to make a query that fetches the newest timestamp from like 12 different tables and I didn't want to have to specify the table names twice
Related Rants
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m...
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
-
linuxxx23*client calls* "hello, we forgot the password to our WiFi router. Could you reset that for us?" 😐😶😮...
What the absolute fuck
Can someone explain why `SELECT foobar FROM sometable` works in MariaDB while `SELECT sometable.foobar` doesn't?
The error is "code 1109. Unknown table foobar in field list"
rant
wtf
mariadb
sql