The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL request

Discussion in 'Database Discussions' started by maestro1303, Jun 4, 2014.

  1. maestro1303

    maestro1303 Registered

    Joined:
    Jun 3, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Dear all
    I have one table which contains 4 fields
    -serie which is an autoincrement(THE KEY)
    -dest which contains a telephone prefix: this field is stored like varchar(40) its length can be one or 40 DIGITS
    -col1, COL2, col3 which they are float
    We have in the following example
    Code:
    47	1246	0,123729	0,1495	0,0885
    48	1248	0,0102	0,005	0,007
    49	1249	0,0052	0,0035	0,0076
    50	1250	0,0052	0,0035	0,0076
    51 	1251	0,0102	0,005	0,007
    52	1252	0,0102	0,005	0,007
    53	1253	0,0102	0,005	0,007
    54	1254	0,0102	0,005	0,007
    55	1256	0,0102	0,005	0,007
    56	1260	0,0102	0,005	0,007
    57	1262	0,0102	0,005	0,007
    58	1264	0,053023	0,1638	0,06
    59	1267	0,0102	0,005	0,007
    60	1268	0,145631	0,0946	0,1045
    61	1269	0,0102	0,005	0,007
    62	1270	0,0102	0,005	0,007
    The aim is to agregate/summarize this table by reducing the lines according to the 3 last columns and the prefixe of course.

    For rexample the following lines
    Code:
    50	1250	0,0052	0,0035	0,0076
    51 	1251	0,0102	0,005	0,007
    52	1252	0,0102	0,005	0,007
    53	1253	0,0102	0,005	0,007
    54	1254	0,0102	0,005	0,007
    55	1256	0,0102	0,005	0,007
    will be reduced to 2 lines
    Code:
    50	1250	0,0052	0,0035	0,0076
    5025 	125	0,0102	0,005	0,007     
    because all prefixes start by 125. Even 50 1250 0,0052 0,0035 0,0076 starts by '125' BUT 0,0052 0,0035 0,0076 are not equal (one by one) to 0,0102 0,005 0,007

    My question is how to make this task in MySQL (by the MySQL requests)
    Many THanks
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,476
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is there some sort of issue with your cPanel? I don't see it here.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page