Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript query returning duplicate rows

Status
Not open for further replies.

STKAndy

Programmer
Oct 14, 2000
2
US
I've got a vbscript program returning duplicate search results. This is a multi-group enabled database which will return all associated files for each group, but not care if they are duplicates from another group. I'm trying to use the keyword DISTINCT, which vbscript seems to be ignoring (though not crashing). Any suggestions?
Thanks in advance,
Andy [sig][/sig]
 
What is the database you are trying to open? SQL Server, MySQL, Access ???? [sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
This is a SQL Server. Here's the code in question (if that helps, with DISTINCT in it):

If DisplayPeriod then
If IsDate(request.form(&quot;BeginDate&quot;)) and IsDate(request.form(&quot;EndDate&quot;)) then
Before = request.form(&quot;BeginDate&quot;)
After = request.form(&quot;EndDate&quot;)
DisplayGood=true
sqlmeet= &quot;SELECT DISTINCT Meetings.ID as MeetID, * FROM &quot; &_
&quot; ((XGrouptoUsers INNER JOIN Users ON XGrouptoUsers.UserID = Users.ID) &quot; &_
&quot;INNER JOIN Groups ON XGrouptoUsers.GroupID = Groups.ID) &quot; &_
&quot;INNER JOIN (Meetings INNER JOIN XMeetingsToGroups ON Meetings.ID = &quot; &_
&quot;XMeetingsToGroups.MeetingID) ON Groups.ID = XMeetingsToGroups.GroupID&quot; &_
&quot; WHERE MeetDate >=' &quot; & Before &_
&quot;' AND MeetDate <=' &quot; & After & &quot;' AND Users.ID = &quot; & session (&quot;USERID&quot;) &_
&quot; ORDER BY EndDate DESC &quot;
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

rs.Open sqlmeet, conn, 3, 3
if rs.recordcount > 0 then
WeHaveRecords = true
end if
Else
Response.Write &quot;<p align=center><b> Please Enter Valid Dates!</b>&quot;
end if

end if
[sig][/sig]
 
Ai, ai, ai!!! I would suggest you move that entire ungainly procedure into a SQL Server stored procedure and call it from ASP. It saves time and effort. Then go complain on the SQL forum :) [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top