Medoo icon indicating copy to clipboard operation
Medoo copied to clipboard

Table Aliases for Oracle queries don't work

Open devASDR opened this issue 1 year ago • 3 comments

Information

  • Version of Medoo: 2.1.7
  • Version of PHP: 8.1.8
  • Type of Database (MySQL, MSSQL, SQLite...): Oracle
  • System (Liunx|Windows|Mac): Windows

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"

devASDR avatar Aug 17 '22 04:08 devASDR

Thanks. I will test and fix for it.

catfan avatar Aug 18 '22 13:08 catfan

I fixed it locally image image

MutionHu avatar Nov 29 '23 03:11 MutionHu

I fixed it locally

can you provide textual diff? ))

demonych avatar Apr 02 '24 12:04 demonych