|
Re: lug-bg: MySql Query
- Subject: Re: lug-bg: MySql Query
- From: Danail Petrov <oneofus@xxxxxxxxxxxxx>
- Date: Fri, 11 Feb 2005 13:55:09 +0200
Danail Petrov wrote:
Ivailo Ivanov wrote:
Privet,
Imam 2 tablici
1 tablica login|unixtime|
2 tablica login|ip|mac|
Iskam ot vtora tablica da izvadia login, ip, mac ako
MAX(UNIXTIME) za sashtia login ot parva tablica e po
malak ot 123456789. Kak tova da se napravi s edno ili
v kraen sluchai s dve querita i temporalni tablici.
__________________________________ Do you Yahoo!? Read only the mail
you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara
Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
select login ip from table1 where table1.login=table2.login and
table1.unixtime<123456789;
нещо такова трябва да е . Незнам дали ще сработи , пиша наизуст. Но
едно бързо query към mysql.org ще те ориентира веднага :)
Поздрави,
Данаил Петров
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara
Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
Айде да бъда малко по изчерпателен:
mysql> select * from table1;
+----+------+----------+
| Id | user | unixtime |
+----+------+----------+
| 1 | dido | 18 |
| 2 | asd | 20 |
+----+------+----------+
2 rows in set (0.00 sec)
mysql> select * from table2;
+----+----------+-------------+
| Id | ip | mac |
+----+----------+-------------+
| 1 | 192.168.0.1 | 00:FF:00:ff |
| 2 | 10.0.0.2 | 00:ab:cd:ff |
+----+----------+-------------+
2 rows in set (0.00 sec)
mysql> select user,ip,mac from table1,table2 where table1.id=table2.id
and unixtime<19;
+------+----------+-------------+
| user | ip | mac |
+------+----------+-------------+
| dido | 192.168.01 | 00:FF:00:ff |
+------+----------+-------------+
1 row in set (0.01 sec)
Поздрави,
Данаил Петров
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|
|
|