Home » U++ Library support » U++ SQL » Select from two temporary tables
Select from two temporary tables [message #38027] |
Wed, 28 November 2012 19:47  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
I need to select columns from two temporary tables, but there is no version of From that takes two SqlSets.
Can you Mirek add this to Sqlexp.h and SqlStatement.cpp:
SqlSelect& From(const SqlSet& set1, const SqlSet& set2);
SqlSelect& SqlSelect::From(const SqlSet& table1, const SqlSet& table2) {
String ts1 = table1(SqlSet::SETOP + 1);
String ts2 = table2(SqlSet::SETOP + 1);
text = "select " + text + " from " + ts1 + ", " + ts2;
tables << ',' << Filter(ts1, CharFilterNotWhitespace);
tables << ',' << Filter(ts2, CharFilterNotWhitespace);
on = false;
return *this;
}
BTW. Postgres doesn't like parentheses around embeded select, so
AsTable should look like this:
SqlSet SqlSelect::AsTable(const SqlId& tab) const
{
StringBuffer t;
t << SqlCase(MSSQL|PGSQL, "")("(") //<---PGSQL added
<< "(" << text << ") as \t" << tab.ToString() << '\t'
<< SqlCase(MSSQL|PGSQL, "")(")"); //<---PGSQL added
return SqlSet(String(t), SqlSet::HIGH);
}
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:29:41 CEST 2025
Total time taken to generate the page: 0.00577 seconds
|