Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 18th, 2004, 02:28 AM
seanwest seanwest is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 25 seanwest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL query in asp page help

hi im trying to get this to work
mySQL3 = "SELECT ViewedBy FROM viewedlist where Nick = '" & userform2 & "' and ViewedBy = '" & userform & "'"

but the problem is that there may be more than one record that has the same nick and more than one that has the same viewed by.

How do i make it grab only the record where nick and viewed by are in the same row and none else?


here is an example.

Nick Viewedby
___ _______

Sean Steve
Jerry Steve
Sean Wilma

so with the statement above, it only seems to pull one line, even though Sean is in there twice.
and the same for steve. (only Sean/Steve would seem to work if i look for Steve as the Viewedby)
i need it to bring back Steve and Wilma if i look for people who viewed Sean. if not the exact statement.

thanks for any help you can give.

Reply With Quote
  #2  
Old September 28th, 2004, 07:53 PM
spungebob spungebob is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Dover
Posts: 128 spungebob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 sec
Reputation Power: 5
Smile easy use OR

mySQL3 = "SELECT ViewedBy FROM viewedlist where Nick = '" & userform2 & "' or ViewedBy = '" & userform & "'"

Reply With Quote
  #3  
Old September 28th, 2004, 09:42 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 8 m 6 sec
Reputation Power: 469
You need to have a primary key on the table, that makes the records unique.

Reply With Quote
  #4  
Old September 30th, 2004, 03:43 PM
techyashish techyashish is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: California,UA
Posts: 42 techyashish User rank is Private First Class (20 - 50 Reputation Level)techyashish User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 3 h 43 m 21 sec
Reputation Power: 5
Send a message via MSN to techyashish Send a message via Yahoo to techyashish Send a message via Google Talk to techyashish
Thumbs up do composite indexing

hi there

make a primary key on both fields then use uniqueidentifier


then try


regards
ashish

mcdba,mct,mcse,mcsd

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > SQL query in asp page help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT