January 11, 2020 Re: [OT] Idea to get all columns from multiple tables in DB | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | > On 1/10/20 3:32 PM, Jacob Carlborg wrote: >> On 2020-01-09 00:03, Steven Schveighoffer wrote: >> >> connection.query("SELECT " ~ fieldsToSQL!User ~ " FROM user").byItem!User; >> >> Where "fieldsToSQL!User" would expand to: >> >> "user.first_name, user.last_name, user.age" >> > That's not the issue. The issue is they will come back as "first_name", "last_name", etc. If you have multiple tables with common column names, then you have an ambiguity, and cannot determine where each column goes. > > -Steve What about : connection.query("SELECT " ~ fieldsToSQL!(User, Equipment) ~ " FROM >> user").byItem!User...; Now all the ambiguity could be coded out by using 'as' where necessary or always. Seems like interesting thoughts to explore. |
Copyright © 1999-2021 by the D Language Foundation