[OT] Idea to get all columns from multiple tables in DB
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Sat Jan 11 19:01:47 UTC 2020
> 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.
More information about the Digitalmars-d
mailing list