TMS Aurelius 2.2 Full Source XE-XE7 | 4.8 Mb ORM framework for Delphi with full support for data manipulation, complex and advanced queries, inheritance, polymorphism, and more...
Query1.Sql.Text := 'SELECT I.ID AS INVOICE_ID, I.INVOICE_TYPE, I.INVOICE_NO, I.ISSUE_DATE, I.PRINT_DATE, ' +
'C.ID AS CUSTOMER_ID, C.CUSTOMER_NAME, C.SEX, C.BIRTHDAY, N.ID AS COUNTRY_ID, N.COUNTRY_NAME' +
'FROM INVOICE AS I INNER JOIN CUSTOMER AS C ON (C.ID = I.CUSTOMER_ID) ' +
'LEFT JOIN COUNTRY AS N ON (N.ID = C.COUNTRY_ID)' +
'WHERE I.ID = :INVOICE_ID;'
Query1.ParamByName('INVOICE_ID').AsInteger := 1;
Query1.Open;
ShowMessage(Format('Invoice No: %d, Customer: %s, Country: %s',
[Query1.FieldByName('INVOICE_NO').AsInteger,
Query1.FieldByName('CUSTOMER_NAME').AsString,
Query1.FieldByName('COUNTRY_NAME').AsString]));