Skip to content
Advertisement

Tag: db2

MAX Date for each row

I am having some difficulty at writing a syntax that will provide me with the most recent date for several results. Little bit of background, I am pulling live data from an IBM AS400, I have no SQL tables, I am connecting to the tables via ODBC, using QTODBC to create my queries, then I export them to Power Bi.

How to retrieve the last record in each group with DB2?

As for MySQL, I know how to retrive the last record in each group, such as: But DB2 is a little bit different, you can only select column which is used after GROUP BY, like this: So, if I want to fetch two columns, I need to GROUP BY them like this: here comes the problem, I can’t retrieve the

Create database user with DDL in DB2

I am trying to create a user using DDL in DB2. I tried this: CREATE USER ‘test_user’ IDENTIFIED BY ‘password’; and I got this error message: An unexpected token “‘test_user’ IDENTIFIED BY ‘…

Advertisement