RSS Forums RSS
Please support our MySQL advertiser: Programming Forums

SQL Query, need major help!

Join Date: Sep 2007
Posts: 1,075
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 62
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: SQL Query, need major help!

  #3  
Nov 8th, 2007
This is what I have so far, all for asp.net:
repeater1: "SELECT UserName, LastLogin, DateCreated, Views, Logged, 
(SELECT COUNT(AlbumID) FROM ProfileAlbums WHERE UserID=?) As TotalAlbums, 
(SELECT COUNT(FriendID) FROM ProfileFriends WHERE UserID=?) As CountFriends, 
(SELECT COUNT(CommentID) FROM ProfileComments WHERE ReceiveUserID=?) As 
CommentsCount FROM Users WHERE UserID=? LIMIT 1"

repeater2: "SELECT AlbumID FROM ProfileAlbums WHERE UserID=? LIMIT 4"

repeater3: "SELECT MainPic As FriendMainPic FROM Users WHERE UserID IN 
(SELECT FriendID FROM ProfileFriends WHERE UserID=?) LIMIT 12"

repeater4: "SELECT ProfileComments.PostUserID, ProfileComments.DateCreated, 
ProfileComments.Comment, Users.UserName As PostUserName, Users.MainPic FROM 
ProfileComments INNER JOIN Users ON Users.UserID=ProfileComments.PostUserID WHERE 
ProfileComments.ReceiveUserID=? LIMIT 25"
I am not sure if it is possible to grab 4 queries with different limit sizes, not to mention if it is smart to bind 4 controls with tons of information rather than take the query hits. It's a profile section, much like myspace's. All by client's request.
Last edited by SheSaidImaPregy : Nov 8th, 2007 at 2:39 pm.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:53 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC