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...
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...
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.
...@SELSTRING with its printed out string (above), the selection works correctly.
Why is it not seeing my declared table @STUS_TO_USE?
Thank you.
********
After I sent this, I tried creating the table #STUS_TO_USE, and now get the error
Cannot resolve the collation conflict between...
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...
...Completed credits for Term
WITH USER_TERM AS
(
SELECT DISTINCT
T.TERMS_ID AS 'USR_TERM',
TL.TERM_CENSUS_DATES AS 'CUR_CENSUS_DATE',
T.TERMS_ID + '*UG' AS 'STTR_TERM',
T.TERM_END_DATE AS 'TERM_END'
FROM TERMS T
LEFT JOIN TERMS_LS TL ON T.TERMS_ID = TL.TERMS_ID
WHERE TL.TERM_CENSUS_DATES IS...
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?
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...
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...
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...
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...
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...
...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 I can assume...
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.