简体   繁体   中英

How to select a few table fields and all of another table like `t1.field, t2.*`

Does anyone know if a one can query a 4D database selecting all of a particular table like one can do in MySQL? I haven't been able to find any documentation on it.

Fails

I've tried this query but it fails to parse Syntax error: 1301 Failed to parse statement.

SELECT c.Customer_Name, p.*
FROM Customer c
JOIN EOE_EDI_Partner p ON p.BillTo_Customer_ID = c.Customer_ID

Works

This works, but gets data from both tables

SELECT *
FROM Customer c
JOIN EOE_EDI_Partner p ON p.BillTo_Customer_ID = c.Customer_ID

And I'd like to refrain from writing out each field in the desired table (its a lot)

SELECT p.Name, p.ID, p.FieldName, p.......
FROM Customer c
JOIN EOE_EDI_Partner p ON p.BillTo_Customer_ID = c.Customer_ID

The doc ( 4D SQL Reference: SELECT ) says it's not possible:

Queries with mixed "*" and explicit fields are not allowed.

They suggest to use * to have all field from both tables (as you made in you first working example) that is:

SELECT * FROM t1, t2

Also you cannot use a subquery instead of t1, I verified it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM