Advertisement

05.27.2003 at 08:41AM PDT, ID: 20627687
[x]
Attachment Details

Trouble Altering a SQL Select to narrow results

Asked by BHaines in Active Server Pages (ASP)

Tags: narrow, phenangle, results, sql

A while back, Fritz helped me get a SQL query working to pull records from a dB and phenangle it to show either the user's assigned name or Unassigned if the record had no one assigned to it. That is working perfectly and is as below:

SQLStmt ="SELECT R.CreatedBy, R.ResearchID, R.AccountName, R.CurrentAccountNo, R.Status, R.RequestDate, R.DateAssigned, R.LocID, C.NickName + ' ' + C.LastName AS CreatedBy2, CASE (A.NickName + ' ' + A.LastName) WHEN ' ' THEN 'Unassigned' ELSE (A.NickName + ' ' + A.LastName) END AS AssignedTo FROM rrmain R INNER JOIN Employees C ON R.CreatedBy = C.EmployeeID LEFT OUTER JOIN Employees A ON R.AssignedTo = A.EmployeeID ORDER BY R.ResearchID"

Unfortunately, the group now wants only the records whose R.LocID matches the current user's LocationID (determined by a stored procedure, it's noted as Session("LocationID"). Further, If a user's Session("LocationID") is 34, that corresponds to a R.LocID of 50. The rest have matching numbers.

I've pulled up the various variables and they are all working correctly, but trying to get it to display just the records for the matching location outside of the SQL query has pulled a no records (despite the fact there are 4 records with a matching location to mine). Since I can't get that to work, I'm hoping someone here can help me modify the SQLStmt to pull only records where the R.LocID = Session("LocationID"), or  if the Session("LocationID") is 34 show all records which have an  R.LocID of 50. As always, any help is appreciated. Thanks in advance.
Start Free Trial
[+][-]05.27.2003 at 09:16AM PDT, ID: 8591401

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.27.2003 at 09:44AM PDT, ID: 8591663

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: narrow, phenangle, results, sql
Sign Up Now!
Solution Provided By: BHaines
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.27.2003 at 09:49AM PDT, ID: 8591699

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.27.2003 at 01:13PM PDT, ID: 8593042

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.27.2003 at 03:02PM PDT, ID: 8593650

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2003 at 07:26AM PDT, ID: 8606147

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2003 at 07:30AM PDT, ID: 8606175

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.01.2003 at 11:08AM PDT, ID: 8624657

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.02.2003 at 05:15AM PDT, ID: 8628802

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.02.2003 at 06:55AM PDT, ID: 8629442

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.02.2003 at 10:29AM PDT, ID: 8631195

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2003 at 01:36PM PDT, ID: 8642463

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2003 at 02:02PM PDT, ID: 8642688

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2003 at 02:12PM PDT, ID: 8642782

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2003 at 04:22PM PDT, ID: 8661617

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2003 at 11:48AM PDT, ID: 8668696

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2003 at 03:35PM PDT, ID: 8670087

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.12.2003 at 03:31PM PDT, ID: 8713134

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32