Skip to content

Tag: mysql

MySQL: Find the last event where the user was tracked

Let’s say your web application tracks the activities of its users using a tracking system. While a user hasn’t logged in or signed up, all the user’s actions are tracked using anonymous_id and the user_id is null, and afterward, they are tracked using the same anonymous_id and user_id. It is…

Check if a pair of records belong to multiple group IDs

I have a table that contains 2 IDs – UserID and GroupID. I need to pull a list of all UserIDs that “share” the same GroupID at least 4 times So, based on the following data set: I’m trying to generate the following result: UserID A UserID B NumberOfOccurrences 1 2 4 2 3 4 1 3 5 I&#8217…

how to single out certain names in sql

So I have this problem in SQL where the question is this: List the sId and name of students that applied to “WSU” But not “U of O”. and my attempt was this: However this does not do the trick as it doesn’t catch that some of the students had already applied to U of O. MRE: And then of

Joining Query with codeigniter Model

Please help me how can I get only response where activities.activity_id = response.activity_id? here is my CI_model My Activities table My Response Table My users table Answer Try with this: You need to add aliases to the tables in order to build a more simplified and ordered query, in this case the aliases a…