I have this sql query that is working fine but would like to convert it into some kind of postgresql or netezza equivalent query. Here are my queries:
SELECT name, location, Date FROM myTable WHERE [Date] < DateAdd(hh, 48, [shipDate]
and other query
SELECT name, location, Date FROM myTable WHERE [Date] < DateAdd(d, 90, [shipDate]
For Netezza the easiest thing to do is use an interval calculation:
SELECT name, location, Date FROM myTable WHERE Date < shipDate + interval '48 hours';
SELECT name, location, Date FROM myTable WHERE Date < shipDate + interval '2 days';
SELECT name, location, Date FROM myTable WHERE Date < shipDate + interval '90 days';
You can also use add_months if you want to do month calculations that are aware of the different length of the months.
SELECT name, location, Date FROM myTable WHERE Date < add_months(shipdate, 3);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With