catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

Table Aliases for Oracle queries don't work #1058

Open devASDR opened 2 years ago

devASDR commented 2 years ago

Information

Describe the Problem When writing a select query for a Oracle database, if we try to set aliases for the tables, the query fails because Medoo puts "AS" keyword between the table name and its alias. This is not a valid syntax in Oracle.

Detail Code The detail code you are using causes the problem.


// Write your PHP code here

$data = $database->debug()->select(
      'TABLE1',
      [
         '[><]TABLE2 (MYALIAS)' => ['ID' => 'EXTID']
      ],
      '*'
    );

**Expected output**
Expected result = SELECT * FROM "TABLE1" INNER JOIN "TABLE2" "MyAlias" ON "TABLE1"."ID" = "MyAlias"."EXTID"
Actual result: SELECT * FROM "TABLE1" INNER JOIN "TABLE2" AS "MyAlias" ON "TABLE1"."ID" = "MyAlias"."EXTID"
catfan commented 2 years ago

Thanks. I will test and fix for it.

MutionHu commented 11 months ago

I fixed it locally image image

demonych commented 7 months ago

I fixed it locally

can you provide textual diff? ))