» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2006, 10:53 AM
gilchrist gilchrist is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
gilchrist is on a distinguished road
Default Returning only one row per user

Hello folks

The current, working query which is simplified for the sake of the problem:

SELECT *
FROM qa4_blogs
WHERE state > '$state'
ORDER BY posted DESC
LIMIT $limit1

The fields include 'id' obviously, and 'mid' for the member id.

Say for example the limit is 3, this will return the most recent 3 blog entries.

However, I want to ensure that within those three rows, there is not more than one per member. I need a clever clause in there.

I know this is a very simple question for you, but please share your views with me, will be appreciated.

Bye -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 07-30-2006, 10:56 AM
naughtyboy naughtyboy is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
naughtyboy is on a distinguished road
Thumbs up

hi

Please don't use select *, there is little to gain from using it. Especially when explaining a problem you need help with. it doesn't explain all your columns.

you will need to explain when there is more than one row per user which one you would like to choose from.

for instance say you have

foo bar qux 2
foo bar soo 2

which of those two you want would tell you how to write your select statement. Yes I know I'm using data different than yours but it will serve a purpose. If you don't care which row per user you would do the query one way, if you want the latest row per user you would write the query another.

Ya, this was pretty simple for me -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
user account form. JKswing Web Hosting Industry 1 10-17-2006 04:11 AM
user account troubles>>> Mikkel MySQL Forums 1 08-17-2006 10:51 AM
Error while storing user information?? Carley MySQL Forums 1 08-14-2006 06:06 AM
Content Management with Multiple User Accounts visioninfotech Google 1 05-31-2006 11:58 PM
Missings in Table User jim MySQL Forums 0 12-08-2005 06:19 AM


All times are GMT. The time now is 08:12 PM.