J
Jason Bailey
Guest
Hi all, While I am certainly not new to databases, I am new to OpenEdge. I have a 10.2B database I'm querying via the SQL Client access driver (JDBC) and I'm having some troubles getting the data the way I'd like it. Hopefully one of you can give me some direction. I'm actually querying a table that contains customer names and various contact methods that have been employed to send them notifications. If a given customer has been contacted via email and via text message, their name will appear twice, as two different rows. The problem is, I don't want duplicates. In this example, I only want one mention of this customer in my result set. I don't care of it is the email response record or the text message response record -- I just need one or the other, but not both. A "SELECT DISTINCT" query on only one field does the trick with a traditional SQL database. In OpenEdge, it appears that a SELECT DISTINCT only applies if ALL of the fields are exactly the same in one or more records (meaning duplicate rows). Consider this example: +----------+----------------+----------+-------------------------+ | CUST_NBR | CUST_NAME | CATEGORY | TIMESTAMP | +----------+----------------+----------+-------------------------+ | 3456 | John Doe | Static | 2016-04-25 08:17:30.134 | +----------+----------------+----------+-------------------------+ | 2789 | George Orwell | Dynamic | 2016-04-25 08:17:32.945 | +----------+----------------+----------+-------------------------+ | 3456 | John Doe | Static | 2016-04-25 08:17:37.256 | +----------+----------------+----------+-------------------------+ Suppose I want to grab only one record per customer (so only one John Doe). The problem is, because the timestamp (which I need) is different from the next row, I still get both John Doe records in my result set. How would I get just one John Doe record (I don't care which)? Hopefully all that makese sense. Could any of you give me any insight into this problem
Continue reading...
Continue reading...