Jump to content
php.lv forumi

COUNT(*)


Paulinjsh

Recommended Posts

Problēma sekojoša. Vajag vairākās tabulās saskaitīt vai tur ir ieraksti kuros user = kautkas.

 

Raxtu SELECT COUNT(*) FROM `Addressies`, `Changes`, `Cities` WHERE `Addressies`.`User` = 1 AND `Changes`.`User` = 1 AND `Cities`.`User` = 1

 

Atgriež man rezultātu COUNT(*) = 0, lai gan apskatoties šīs tabulas tajās ir ierakti, kuros User = 1. Gaidu jebkuru risinājumu.

Edited by Paulinjsh
Link to comment
Share on other sites

Problēma sekojoša. Vajag vairākās tabulās saskaitīt vai tur ir ieraksti kuros user = kautkas.

 

Raxtu SELECT COUNT(*) FROM `Addressies`, `Changes`, `Cities` WHERE `Addressies`.`User` = 1 AND `Changes`.`User` = 1 AND `Cities`.`User` = 1

 

Atgriež man rezultātu COUNT(*) = 0, lai gan apskatoties šīs tabulas tajās ir ierakti, kuros User = 1. Gaidu jebkuru risinājumu.

12400[/snapback]

 

Ja tas ir tas ko tu veeleejies

resp. atgrieziis daudzumu

SELECT COUNT(Addressies.*) as c1, COUNT(Changes.*) as c2, COUNT(Cities.*) as c3
FROM Addressies, Changes, Cities
WHERE Addressies.User=Changes.User AND Changes.User=Cities.User AND Cities.User=1

Link to comment
Share on other sites

×
×
  • Create New...