Post by Deane Yangselect trades.price, bonds.coupon from trades, bonds where trades.id =
bonds.id
I don't see why it should not work.
One of possible examples how to use SOCI with such query:
session sql(backEnd, connectString);
sql << "create table trades (id integer, p integer)";
sql << "create table bonds (id integer, c integer)";
sql << "insert into trades (id, p) values (1, 100)";
sql << "insert into trades (id, p) values (2, 200)";
sql << "insert into trades (id, p) values (3, 300)";
sql << "insert into bonds (id, c) values (1, 7)";
sql << "insert into bonds (id, c) values (3, 9)";
auto init_fetch = 2U;
std::vector<int> prices(init_fetch);
std::vector<int> coupons(init_fetch);
sql << "select trades.p, bonds.c "
<< "from trades, bonds where trades.id = bonds.id"
, into(prices), into(coupons);
std::transform(prices.cbegin(), prices.cend(), coupons.cbegin(),
std::ostream_iterator<std::string>(std::cout, "\n"),
[] (int p, int c) {
return "price: " + std::to_string(p) +
", coupon: " + std::to_string(c);
});
// price: 100, coupon: 7
// price: 300, coupon: 9
p.s. Seems you've sent this post from different e-mail than the subscribed,
if you want me to whitelist this additional e-mail, just let me know.
Otherwise, it is held for moderation
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net