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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. ghbeers

    Trying to get a select statement to behave

    I have a table XYZ which looks something like: ID POS DO_THESE INQUIRY_ONLY -- --- -------- ------------ AX 1 A A AX 2 B C AX 3 C E AX 4 D AX 5 E AZ 1 U V AZ 2 V AZ 3 W ... I have a list statement with several columns like ID, NAME, DO_THESE, INQUIRY, ETC So for the MAINT Column, I...
  2. ghbeers

    I'm creating a stored procedure. I

    THANK YOU Frederico Fonseca for giving me the solution. It put me back in business. My insert and dynamic query is working beautifully. Thank you again. Thank you to the first responder for also pointing out the real problem. Since there are many of the details of SQL I've not run across...
  3. ghbeers

    I'm creating a stored procedure. I

    Thank you both for getting back to me. I will check into the problems you see. And I can replace the use of the function, which is one of the 3-part key. Because of the values I'm looking for, I can use a substring instead. Thank you again.
  4. ghbeers

    I'm creating a stored procedure. I

    I'm creating a stored procedure. I have declared some @tables, and some @variables to handle variable years that are entered by the user. eg. @FAYEAR1 = <2013>, @FAYEAR2 = <2014>, etc. These years will be used for variable file suite table name that are TA_YYYY. Then I have temp table...
  5. ghbeers

    Stuck on getting only first valid record from associated table

    I figured this out about 2 seconds before I saw you response come in. Here's what I ended up doing with the last CTE that is working correctly. Thank you for getting back to me. HAVE_GRADE_STUS AS ( SELECT distinct RPT.STTR_KEY FROM RPT_STTR_STUS RPT JOIN STUDENT_TERMS_LS STTR ON...
  6. ghbeers

    Stuck on getting only first valid record from associated table

    I am absolutely stuck on finding ONLY 1 record that exists in an associated table that meets my minimum requirement. I have a table STUDENT_TERMS that is for a student and specific term. In the table are keys to all of the course info the student has signed up for the semester. When I go to...
  7. ghbeers

    Is there a way I can pull data from

    Is there a way I can pull data from tables like those in the attached to align in the preferred manner? The 3rd party app that's pulling the results in can seem to take care of it. Any ideas?
  8. ghbeers

    Subquery question

    I ended up going with the CTE method. It works well and is very fast. Thank you all for your suggestions.
  9. ghbeers

    Using the below tables and the logi

    I'm looking for one result per STUDENT from the ACADEMICS table.
  10. ghbeers

    Using the below tables and the logi

    Using the below tables and the logic in the pseudo code, In my SQL query I'm having trouble getting the correct date value when the A.STUDENT is NOT in the LATEST_DATE table. In my query I have the LATEST_DATE table in a left join, and using OR conditions, but it's not correctly getting the...
  11. ghbeers

    Subquery question

    Yesterday I began to build the CTE approach that kjv1611 suggests to see if it's a better choice, and will continue this morning. I'll also apply Frederico's recommendations. If both are viable methods, it'll come down to which executes more efficiently, because this single set of logic in my...
  12. ghbeers

    Subquery question

    ABBREVIATION OF ACTUAL QUERY i WOULD LIKE TO HAVE, BUT DOESN'T WORK TABLES ARE A LITTLE TOO COMPLEX TO GIVE EXAMPLES.... SELECT P.ID (SELECT TOP 1 S.STC_TERM FROM STUDENT_ACAD_CRED S LEFT JOIN STC_STATUSES SS ON S.STUDENT_ACAD_CRED_ID = SS.STUDENT_ACAD_CRED_ID...
  13. ghbeers

    Subquery question

    I'm trying NOT to create a temp table to do what I need because my 3rd party reporting software will require a stored procedure, and yet the 3rd party software has a bug preventing me to do so. So, I was hoping to be able to do something like you see below. Is this possible? I'm definitely...
  14. ghbeers

    Getting error &quot;Each GROUP BY expression must contain at least ...&quot;

    Well Olaf, I can't believe that I didn't see that typo. Yes that should have been stc1, not stc, and the query is now working correctly. I guess I was staring at this thing for so long that I failed to look at the obvious. Should have been the first thing I did. THANK YOU so much for seeing...
  15. ghbeers

    Getting error &quot;Each GROUP BY expression must contain at least ...&quot;

    I get perfect results in the other columns without having to group anything.
  16. ghbeers

    Getting error &quot;Each GROUP BY expression must contain at least ...&quot;

    When I changed that item to: (SELECT SUM(STC.STC_CRED) FROM STUDENT_ACAD_CRED STC1 JOIN STUDENT_TERMS_LS STL1 ON STL1.STUDENT_TERMS_ID = TTAB.TA_STU_ID + '*' + @AWDP + '*UG' WHERE STC1.STUDENT_ACAD_CRED_ID = STL1.STTR_SCHEDULE GROUP BY STC1.STC_PERSON_ID) REG_CRED, I think...
  17. ghbeers

    Getting error &quot;Each GROUP BY expression must contain at least ...&quot;

    I just removed the underlining. Thank you for pointing that out.
  18. ghbeers

    Getting error &quot;Each GROUP BY expression must contain at least ...&quot;

    I don't understand why I'm getting the error "Each GROUP BY expression must contain at least one column that is not an outer reference" because I really do not understand what it means. Can someone help me understand its true meaning? I have a temp which is driving the selection. It is...
  19. ghbeers

    I have a 3 part key that look like:

    Thank you SgtJarrow, this is what I needed. I already know the starting value or the middle part, it's always 9. But I was just doing something basically wrong when trying to isolate the middle value. Thank you so much.
  20. ghbeers

    I have a 3 part key that look like:

    Thank you for responding. Yes the asterisk is the delimiter. I also failed to mention I'm working in SQL Server. INSTR is not being recognized as a built-in function. I'm sorry for the misinformation.

Part and Inventory Search

Back
Top