Reputation: 11
I was Struggling with the node "Database Query".
It shows the default Query as "SELECT * FROM #table# "
While entering the query it shows the error as "Invalid Settings" Database view place holder #table# must not be replaced.
What actually #table# represent?
How does the Database Query node execute?
Can anyone repond, please.
Upvotes: 0
Views: 2139
Reputation: 613
#table# represents the table in the incoming database connection port. The node wraps this incoming connection as a sub query, so for example if you have a connection to a table called 'Names' with a column 'Surname', a column 'Forename' and a column 'Age', and you have previously used a database row filter node to filter by Surname='Smith' then the incoming connection will look something like:
SELECT * FROM (SELECT * FROM Names) table_1234567890 WHERE "Surname"='Smith'
If you want to then use the Database Query Node to search for all people John Smith, aged 30 - 45, then in the node dialog you set
SELECT * FROM #table#
WHERE Forename='John' AND Age BETWEEN 30 AND 45
Now, if you look at the output port, on the 'Connection' tab, the SQL will look something like:
SELECT * FROM (SELECT * FROM (SELECT * FROM Names) table_1234567890 WHERE "Surname"='Smith') WHERE Forename='John' AND Age BETWEEN 30 AND 45
Upvotes: 2