I am having problems displaying a view I created (successfully in sqlite3) using ruby.
Below is the sqlite view
CREATE VIEW members_ytd_totals AS
SELECT id AS MemberID,
first_name,
last_name,
ipu_dues.total AS TotalDues,
ipu_levy.total AS TotalLevy,
ipu_fines.total AS TotalFines,
ipu_donation.total AS TotalDonations,
ipu_registration.total AS TotalRegistrations
FROM ipu_profile
INNER JOIN
ipu_dues ON ipu_dues.id = ipu_profile.id
INNER JOIN
ipu_levy ON ipu_levy.id = ipu_profile.id
INNER JOIN
ipu_fines ON ipu_fines.id = ipu_profile.id
INNER JOIN
ipu_donation ON ipu_donation.id = ipu_profile.id
INNER JOIN
ipu_registration ON ipu_registration.id = ipu_profile.id;
normally i should be able to use a simple select statement in ruby to display this view like
require 'sqlite3'
require 'sqlite_print_table'
db = SQLite3::Database.open 'database.db'
db.print_table("SELECT * FROM members_ytd_totals", guide_tolerance: 4, width_tolerance: 5, margin: 10)
however I get A database Exception occurred - ambiguous column name: id
however inside sqlite3, this view was created properly, with no errors and I can see the view in Sqlite studio. I just cannot display it in ruby. Any ideas what the problem can be?
Thanks