We help IT Professionals succeed at work.
Get Started

LATEST DATE IN A QUERY

SOUTHAMERICA70
on
367 Views
Last Modified: 2012-11-27
I wanted to get the latest date in this query string.....and show only a single result.

Essentially get the latest date from SOURCE_START_TS first and then get the latest date from the LATEST field.

That would yield one row of data verses 300 for example.....below is my query string....

SELECT DISTINCT BCDW_PROD_V_ER_ITEM_PURCHASE_BP_V.ITEM AS PN, BCDW_PROD_V_ER_ITEM_PURCHASE_BP_V.BUY_FROM_BUS_PARTNER AS SUPPLIER_CODE, BCDW_PROD_V_ER_BUSINESS_PARTNER_V.ERP_NAME AS SUPPLIER, BCDW_PROD_V_ER_ITEM_PURCHASE_BP_V.SOURCE_START_TS, BCDW_PROD_V_ER_BUSINESS_PARTNER_V.SOURCE_START_TS AS LATEST
FROM BCDW_PROD_V_ER_ITEM_PURCHASE_BP_V INNER JOIN BCDW_PROD_V_ER_BUSINESS_PARTNER_V ON BCDW_PROD_V_ER_ITEM_PURCHASE_BP_V.BUY_FROM_BUS_PARTNER = BCDW_PROD_V_ER_BUSINESS_PARTNER_V.BUSINESS_PARTNER;
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE