Humpty Posted August 20, 2010 Share Posted August 20, 2010 G'day Guys, As part of an assignment i need to display every 2nd record in the SQL. I am lost and need a point in the right direction. From a slight programming background I am thinking somehting like: SELECT * FROM table STEP 1 Link to comment https://forums.phpfreaks.com/topic/211244-display-every-nth-record-without-using-order-by/ Share on other sites More sharing options...
Humpty Posted August 20, 2010 Author Share Posted August 20, 2010 Got it. it was all in the SELECT DISTINCT on (field name), field, field etc... select distinct on (t1.fixtureid) t1.fixtureid, t1.teamid, t1.score, t2.teamid, t2.score from results t1 join results t2 on t2.fixtureid = t1.fixtureid where t2.teamid != t1.teamid; Link to comment https://forums.phpfreaks.com/topic/211244-display-every-nth-record-without-using-order-by/#findComment-1101513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.