select b.status, h.je_source, (select USER_JE_CATEGORY_NAME from GL_JE_CATEGORIES where JE_CATEGORY_NAME = h.je_category) je_category, B.DEFAULT_PERIOD_NAME, b.name, h.name, h.currency_code, b.running_total_dr, b.running_total_cr, h.description, h.period_name, h.default_effective_date, (select gcc.concatenated_segments from gl_code_combinations_kfv gcc where gcc.code_combination_id = l.code_combination_id) concatenated_segments, l.accounted_dr, l.accounted_cr, l.description, l.context, l.attribute1, l.attribute2, l.attribute3, l.attribute4, l.attribute5, l.attribute6, l.attribute7, l.attribute8, l.attribute9, l.attribute10, l.attribute11, l.attribute12, l.attribute13, l.attribute14, l.attribute15, l.attribute16, l.attribute17, l.attribute18, l.attribute19, l.attribute20 from gl_je_batches b, gl_je_headers h, gl_je_lines l where b.je_batch_id = h.je_batch_id AND (h.display_alc_journal_flag = 'Y' or h.display_alc_journal_flag is null) and h.je_header_id = l.je_header_id and h.je_source = 'Manual' and h.doc_sequence_value like '5020%' and b.default_period_name = 'JAN-17'