�����������
�����
������
������� ��������� �������� VPS - ������� ������ �������� Dedicated server
�������:

VPS - �������:

������ ��������:

Dedicated server:


������ ���������:

������ ����������� ��������

www.megastock.ru

Z-Payment
������ ������
Moneybookers
Payment Network
��������
Contact
�������� ������
MasterCard
VISA
������� CONTACT
�������� �������
��� 24
WIRE USD EURO
������ Z-PAYMENT
SMS ������
��������� ����
��������� ������-�����
��������� ComePay
��������� FreeCash

�����������  �������. �������

�������:










MySQL

3.5.4 ,

3.5.4 ,

" , () ?"

ANSI SQL :

SELECT article, dealer, price
FROM   shop s1
WHERE  price=(SELECT MAX(s2.price)
              FROM shop s2
              WHERE s1.article = s2.article);

MySQL :

  1. (, )
  2. , , .

:

CREATE TEMPORARY TABLE tmp (
        article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
        price   DOUBLE(16,2)             DEFAULT '0.00' NOT NULL);

LOCK TABLES shop read;

INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;

SELECT shop.article, dealer, shop.price FROM shop, tmp
WHERE shop.article=tmp.article AND shop.price=tmp.price;

UNLOCK TABLES;

DROP TABLE tmp;

TEMPORARY, tmp.

" ?"

, , " MAX-CONCAT":

SELECT article,
       SUBSTRING( MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 7) AS dealer,
  0.00+LEFT(      MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 6) AS price
FROM   shop
GROUP BY article;

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
|    0001 | B      |  3.99 |
|    0002 | A      | 10.99 |
|    0003 | C      |  1.69 |
|    0004 | D      | 19.95 |
+---------+--------+-------+

, , .






Prime-Hosting.Ru:













Prime-Hosting.Ru:





Copyright 2008-2010
Prime Hosting
Prime Hosting. , VPS - ,  , dedicated serverPrime Hosting. , VPS - , , dedicated server:
VPS - Dedicated server