SELECT 
    PARTNERS.ID, 
    PARTNERS.NAME, 
    PARTNERS.DESCRIPTION, 
    PARTNERS.ID_NS, 
    PARTNERS.NS_CODE, 
    PARTNERS.NS_NUMBER, 
    PARTNERS.NS_EVID_CODE, 
    PARTNERS.DATE_ADD, 
    PARTNERS.TITLE_BEFORE_NAME, 
    PARTNERS.FORNAME, 
    PARTNERS.SURNAME, 
    PARTNERS.TITLE_BEHIND_NAME, 
    PARTNERS.VAT_PAYER, 
    PARTNERS.IS_BRANCHE, 
    PARTNERS.ID_PARENT, 
    PARTNERS.REG, 
    PARTNERS.TAX, 
    PARTNERS.ID_TAXOFFICES, 
    PARTNERS.BIRTH_NO, 
    PARTNERS.INACTIVE, 
    PARTNERS.WEIGHT, 
    PARTNERS.IS_DODGER, 
    PARTNERS.FLAG, 
    PARTNERS.VAT_NO_STATE, 
    PARTNERS.VAT_NO_NUM, 
    PARTNERS.IDENTITY_CARD_NO, 
    PARTNERS.DRIVING_LICENSE_NO, 
    PARTNERS.SOCIAL_INST_NO, 
    PARTNERS.MARK, 
    PARTNERS.SHORTNAME, 
    PARTNERS.ID_PARTNERS_GROUPS, 
    PARTNERS.MATURITY_SENDEDINVOICES, 
    PARTNERS.MATURITY_RECEIVEDINVOICES, 
    PARTNERS.NOTGENERATE_PENALTYINVOICES, 
    PARTNERS.NOTGENERATE_REMINDERS, 
    PARTNERS.SYS, 
    PARTNERS.RATING, 
    PARTNERS.ID_USER_CHANGED, 
    PARTNERS.ID_USER_DELETED, 
    PARTNERS.DATE_CHANGED, 
    PARTNERS.DATE_DELETED, 
    PARTNERS.DATE_ACTUAL_FROM, 
    PARTNERS.DATE_ACTUAL_TO, 
    PARTNERS.HISTORY_VERSION, 
    PARTNERS.ID_MASTER, 
    PARTNERS.GUID, 
    PARTNERS.CODE, 
    PARTNERS.CENTER, 
    PARTNERS.DEPARTMENT, 
    PARTNERS.VAT_SENDED_DOCUMENT, 
    PARTNERS.VAT_RECEIVED_DOCUMENT, 
    PARTNERS.GUID_OMEGA, 
    PARTNERS.IS_EXPORTED, 
    PARTNERS.TRANSPORT_TYPE, 
    PARTNERS.PAYMENT_TYPE, 
    PARTNERS.ID_BA_REGISTER, 
    PARTNERS.NAME_PARSED, 
    PARTNERS.REG_PARSED, 
    PARTNERS.GUID_EXT, 
    PARTNERS.CREDIT_SETTINGS, 
    PARTNERS.CREDIT_VALUE, 
    PARTNERS.CREDIT_UNPAYER, 
    PARTNERS.ID_IATREE_1, 
    PARTNERS.ID_IATREE_2, 
    PARTNERS.ID_IATREE_3, 
    PARTNERS.ID_IATREE_4, 
    PARTNERS.ID_IATREE_5, 
    PARTNERS.ID_IATREE_6, 
    PARTNERS.DOCUMENTATION_AVAL, 
    PARTNERS.HAS_STOCK_ITEM_PRICE_LIST, 
    PARTNERS.HAS_STOCK_ITEM_GROUP_PRICE_LIST, 
    PARTNERS.PARTNER_EAN
FROM
     PARTNERS
WHERE
    (PARTNERS.HISTORY_VERSION = 1) AND (PARTNERS.FLAG < 3)


