This query executes fine by itself:
SELECT count(id) as countr, username FROM endeavor_search WHERE IN (SELECT username FROM endeavor_member Info WHERE workingWith = @workingWithID) AND searchDate > @maxDate GROUP BY username;
When trying to put it in a variable within a stored procedure, it fails:
SET @savedSearches = (SELECT count(id) as countr, username FROM endeavor_search WHERE EXISTS (SELECT username FROM endeavor_member Info...
User Profile
Collapse
-
SP kills a query when put in a parameter... help?
-
UPDATE
After extensive reading I have changed my approach...
I'm selecting the sums grouped by usernames from each of the three tables and storing them in temp tables but I'm stuck on something I;ve never dopne before - a union select statement
What I hope to achieve with this select statement is a full count of all activity per member, and from there I should be able to loop through those results and... -
VERY Complex stored procedure... I'm lost. Help?
I don't even know if this is possible - I'm still fairly new to stored procedures.
I have 4 tables I need to compile data from:
saved_searches
saved_homes
printed_homes
member_info
saved_searches, saved_homes and printed_homes each track the date they were created.
I need to grab all the users from member_info who have had activity in saved_searches, saved_homes and printed_homes...
No activity results to display
Show More
Leave a comment: