下面兩個表平局是我的表在MySQL:查詢在一個
----------------1-------------------------
+---------------------------+----------+
| email | attempts |
+---------------------------+----------+
| [email protected] | 70 |
| [email protected] | 1 |
| [email protected] | 1 |
| [email protected] | 115 |
+---------------------------+----------+
---------------2------------------------
+----------+---------------------------+
| accesses | email |
+----------+---------------------------+
| 24 | [email protected] |
| 0 | [email protected] |
| 0 | [email protected] |
| 90 | [email protected] |
+----------+---------------------------+
查詢在一個
Email Accesses Attempts
email1 24 70
email2 0 1
email3 0 1
email4 90 115
它是SQL兩個表抽獎:
- first - >
select accesses, email from user;
- second - >
select email,count(*) as intentos from userstats where intento =1 group by email;
我該怎麼做? 我需要一個查詢來繪製。感謝的提前..
曾經heared約'join'? – 2012-03-25 07:23:16
哪個是'userstats'表? – egrunin 2012-03-25 07:41:37
你應該考慮規範你的模式。如果每個電子郵件地址在每個表中都有一個條目,那麼您可能需要考慮將這兩個表合併成一個。 – liquorvicar 2012-03-25 09:32:51