taith Posted May 15, 2007 Share Posted May 15, 2007 ok... heres what i'm trying to do... 1) i have a database divinelive_messages table with a sessid column 2) i need to find out rows from the database, which only show that sessid in there once any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/ Share on other sites More sharing options...
stevesimo Posted May 15, 2007 Share Posted May 15, 2007 You can use the SQL statement Distinct so that only 1 instance of each ID is selected ie. Select Distinct sessidfield from divinelive_messages Hope this helps Steve Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/#findComment-253456 Share on other sites More sharing options...
taith Posted May 15, 2007 Author Share Posted May 15, 2007 ya... but that would give me 1 of everything... i only want ones that are only in there once... if its more, scratch if off the list... Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/#findComment-253465 Share on other sites More sharing options...
stevesimo Posted May 15, 2007 Share Posted May 15, 2007 Am not sure on the exact usage but something like this might work ie. Select sessidfield from divinelive_messages Where COUNT(sessidfield) = 1 Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/#findComment-253467 Share on other sites More sharing options...
jitesh Posted May 15, 2007 Share Posted May 15, 2007 Select sessidfield from divinelive_messages group by sessidfield having count(sessidfield) = 1 Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/#findComment-253470 Share on other sites More sharing options...
taith Posted May 15, 2007 Author Share Posted May 15, 2007 sweet thanks! Quote Link to comment https://forums.phpfreaks.com/topic/51472-solved-mysql-query/#findComment-253475 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.