Skip to content

Get most common value in column [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I have next table: How I can get most common (common means that the count of 2 is 3, count o…

Laravel 5.6.9 – database count gives different outputs

Does anyone know why these two ways to count numbers of users in my table give different answers when i run them in tinker? AppModelsUser::count() => 92269 $count = DB::table(‘users’)->count() => 92829 Running a SQL query in Sequel Pro gives 92829. Answer If you have the SoftDelete trait …

Using WITH and subset in CASE construction

Greetings to senior colleagues. I got caught up in this thing. It is necessary to substitute the corresponding values in the CASE when the construction depending on the state of the load_date field. The problem is that the second was assigned a value to the mean_v field based on the calculation of the average…

Count if the data is not unique

I have a table of store information describing which stores are linked with one another. The data might look like this: | store_id | link_num | linked_store | |   1  | 1 | 10 | |   …