Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pomoc z utworzeniem odpowiedniego SELECT
saren_as
post
Post #1





Grupa: Zarejestrowani
Postów: 53
Pomógł: 0
Dołączył: 21.07.2008

Ostrzeżenie: (0%)
-----


Witam.
Mam takie tabele:

  1. CREATE TABLE `vservers_status` (
  2. `vserver_ip` varchar(15) NOT NULL DEFAULT '',
  3. `filer_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  4. `node_id` int(10) UNSIGNED DEFAULT NULL,
  5. `started` tinyint(1) NOT NULL DEFAULT '0',
  6. `cpu_parts` int(10) UNSIGNED NOT NULL DEFAULT '0',
  7. `cpu_usage` int(10) UNSIGNED NOT NULL DEFAULT '0',
  8. `mem_size` int(10) UNSIGNED DEFAULT NULL,
  9. `mem_usage` int(10) UNSIGNED NOT NULL DEFAULT '0',
  10. `disk_size` int(10) UNSIGNED DEFAULT NULL,
  11. `disk_usage` int(10) UNSIGNED NOT NULL DEFAULT '0',
  12. `net_usage` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  13. `_net_last` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  14. `mem_usage_as` int(10) UNSIGNED NOT NULL DEFAULT '0',
  15. `mem_size_as` int(10) UNSIGNED NOT NULL DEFAULT '0',
  16. `net_usage_down` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  17. `_net_last_down` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  18. `net_usage_up` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  19. `_net_last_up` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  20. `date_created` datetime DEFAULT NULL,
  21. `last_modified` timestamp(14) NOT NULL,
  22. PRIMARY KEY (`vserver_ip`),
  23. UNIQUE KEY `index01` (`vserver_ip`)
  24. ) TYPE=InnoDB;

i

  1. CREATE TABLE `filers` (
  2. `filer_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  3. `mount_point` varchar(255) NOT NULL DEFAULT '',
  4. `hostname` varchar(50) NOT NULL DEFAULT '',
  5. `production` tinyint(1) NOT NULL DEFAULT '0',
  6. `running` tinyint(1) NOT NULL DEFAULT '0',
  7. `fs_size` int(10) UNSIGNED NOT NULL DEFAULT '0',
  8. `fs_usage` int(10) UNSIGNED NOT NULL DEFAULT '0',
  9. `mem_size` int(10) UNSIGNED DEFAULT NULL,
  10. `mem_usage` int(10) UNSIGNED DEFAULT NULL,
  11. PRIMARY KEY (`filer_id`)
  12. ) TYPE=MyISAM;


Jak zbudowac SELECT, aby wyswietlilo mi
vserwer_ip z filer_id o wartosciach >= 5
+
ilosc wolnego miejsca na filer_id o wartosci 1 (czyli: fs_size - fs_usage WHERE filer_id = 1)

Da rade to zrobic w jednym selekcie czy musze to zbudowac jako dwie zmienne?

Dzieki za rady i przepraszam za brak polskich znakow, ale nie mam polskiej klawiatury!
Pozdrawiam!
saren_as

Ten post edytował batman 15.09.2008, 10:05:57
Powód edycji: poprawiłem bbcode ~batman
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 18:56