On 3/8/2018 10:41 PM, Balaji Ramanathan wrote:
CREATE VIEW TripDetailsRaw AS select *
from Trip
inner join Place P1 on Trip.Origin = P1.PlaceID
inner join Place P2 on Trip.Destination = P2.PlaceID;
When I look at the output of this view (I type in "select * from
tripdetailsraw" at the sqlite command line, I see one set of columns from
P1 and another set of columns from P2 with ":1" appended to the repeated
column names ("PlaceName:1", "Country:1", etc.). But I have no idea how to
add a WHERE clause to my select that references these columns.
Don't use "select *" in the view. Explicitly select columns you need, assign
aliases to them as needed. As in
select p1.country as OriginCountry, p2.country as DestinationCountry, ...
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users