2017-02-28 4 views
0

Ich habe 3 Abfragen wieWie 3 Abfragen kombinieren

SELECT count(*) AS Notificationcount FROM notifications WHERE email='$email' and seen='NO' 
    UNION ALL 
    SELECT count(*) AS MessageCount FROM messages WHERE email_to='$email' and seen='NO' 
    UNION ALL 
    SELECT count(*) AS FriendsCount from friends where profileid2='$email' and requeststatus='pending' 

Ich wollte Ergebnis kombinieren 3 Abfragen in einer Wie können wir das tun Vielen Dank im Voraus

Antwort

0
select 
(SELECT count(*) AS Notificationcount FROM notifications WHERE email='$email' and seen='NO') as a, 
(SELECT count(*) AS MessageCount FROM messages WHERE email_to='$email' and seen='NO') as b, 
(SELECT count(*) AS FriendsCount FROM friends where profileid2='$email' and requeststatus='pending') as c 
+0

Danke mein Problem gelöst – Shankar

+0

Danke @juergen d – Shankar