var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: db2 Sql
Hi - We have db2 V9 database.
please help me that the rows with the smaller ID numbers are returned first. I'm not 100% sure how to modify the indexes to do this. I checked all the common files in our normalizer and this is the current query used where the order of the results matter.
SET query = 'SELECT P.BUSINESS_NAME, A.STREET_NO, A.STREET_NAME, A.CITY, A.ZIP_POSTAL_CODE, A.STATE_PROV, A.COUNTRY,
C.FIRST_NAME, C.LAST_NAME, C.PHONE, C.EMAIL
FROM IDS.PARTICIPANT_ADDRESS AS A, IDS.PARTICIPANT AS P, IDS.PARTICIPANT_CONTACT AS C
WHERE P.ID = ? AND P.ID = C.PARTICIPANT_ID AND P.ID = A.PARTICIPANT_ID AND C.ROLE_ID= (SELECT R.ID FROM IDS.ROLE AS R WHERE R.NAME = ?)';
Please advise on how to make sure that the above query returns the smaller ID rows first.
Try using ORDER BY on the SELECT. DB2 does not guarantee the order of a result set unless the ORDER BY is used.
Thanks for your quick response. Please explain little more that on which col i can use order by to get smaller id.
Please read the manual (it is free). It will explain the ORDER BY clause. Only you know how you want it sorted.