Recent

Author Topic: Zeos - table name with JOIN  (Read 2415 times)

tomek

  • Jr. Member
  • **
  • Posts: 85
Zeos - table name with JOIN
« on: April 27, 2012, 09:57:55 pm »
I've sql query with JOIN tables, with SELECT table1.field table2.field

ZReadOnlyQuery1.Fields.DisplayName give me only field name.
How to get the name of the table to which each filed belongs ?

JD

  • Hero Member
  • *****
  • Posts: 1796
Re: Zeos - table name with JOIN
« Reply #1 on: April 27, 2012, 11:10:59 pm »
Try ZReadOnlyQuery1.Connection.Name

JD
Windows (10, 7) - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

tomek

  • Jr. Member
  • **
  • Posts: 85
Re: Zeos - table name with JOIN
« Reply #2 on: April 27, 2012, 11:21:48 pm »
Try ZReadOnlyQuery1.Connection.Name

JD

Formating broke my post :), should be
Code: [Select]
ZReadOnlyQuery1.Fields[i].DisplayNameBy ZReadOnlyQuery1.Connection.Name  I get "ZConnection1" but I want to get name of the table.

JD

  • Hero Member
  • *****
  • Posts: 1796
Re: Zeos - table name with JOIN
« Reply #3 on: April 28, 2012, 12:16:55 am »
AFAIK, this is only possible if you are using ZTable. ZReadOnlyQuery and ZQuery by design do not allow this since they execute SQL statements that contain the name of the table(s) on which the query is performed.
Windows (10, 7) - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

 

TinyPortal © 2005-2018