Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

QueryDatabaseTable with an OR instead of AND when using multiple Maximum-value Columns

avatar
Explorer

Hi,

 

i'm using QueryDatabaseTable processor to incrementally load data from a database table using two columns to perform the incremental load. However, I noticed that the query that fetches the fresh rows is as follows:

 

Select * from myTable where (mycolumn1 > someValue AND myclumn2 > somevalue)

 

However, this does not meet my business need and I would like to perform the following to fetch new records:

Select * from myTable where (mycolumn1 > someValue OR mycolumn2 > somevalue)

 

How can this be achieved? 

Appreciate your help. Thanks

 

 

2 REPLIES 2

avatar
Master Guru

I would recommend creating a view with that query and have it watch some synthetic column.

 

Or in NiFi use two QueryDatabaseTableRecord processors.

 

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.12.1/org.apach...

 

And use QueryDatabaseTableRecord not QueryDatabaseTable.

avatar
Explorer

Thanks for the answer @TimothySpann 

The thing is, we don't can't have source create custom views for us. Is there any other way to achieve this?