Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Aliases for Oracle queries don't work #1058

Open
devASDR opened this issue Aug 17, 2022 · 3 comments
Open

Table Aliases for Oracle queries don't work #1058

devASDR opened this issue Aug 17, 2022 · 3 comments
Labels

Comments

@devASDR
Copy link

devASDR commented Aug 17, 2022

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"
@catfan catfan added the bug label Aug 18, 2022
@catfan
Copy link
Owner

catfan commented Aug 18, 2022

Thanks. I will test and fix for it.

@MutionHu
Copy link

I fixed it locally
image
image

@demonych
Copy link

demonych commented Apr 2, 2024

I fixed it locally

can you provide textual diff? ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants