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 Quote 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; Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.