• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How do I get friend list from Friends table with counts of friends of my friends

phpmysqlnode.js


PHP Snippet 1:

select user_id, count(*) cnt 
   from  Friends 
   where user_id in  
      (select friend_user_id 
         from Friends 
         where user_id = user_id_of_A)
   group by user_id

Related Snippets

Adding custom body class to the custom archive pages

Require a class from another class - php

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Yii2 select2 database exception number of bound variables does not match number of tokens

Assign output of PHP function to a variable

Combine multiple columns into an array as one of the key in a results set

Symfony 4: "Autowire: you should configure its value explicitly."

Laravel: Create morphs() relationship nullable

How to create a scheduler application in php

Distribute array row data to make multiple new rows

xdebug 3 not working in ubuntu 20.04 with docker

httpd.conf on Windows: can't locate API model structure `php8_module`

How to Generate PDF invoice to XML format using mPDF

Reducing authentication calls on external API (Laravel 5.6)

WooCommerce - unset "<product> removed notice…" on cart page

About Contact Privacy policy Terms and conditions