Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6908091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:31:05+00:00 2026-05-27T08:31:05+00:00

Say I have two tables as outlined below: mysql> show columns from ping; +————+——————+——+—–+———+—————-+

  • 0

Say I have two tables as outlined below:

mysql> show columns from ping;
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| ping_id    | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| msg_size   | int(10) unsigned | YES  |     | NULL    |                |
| version    | int(10) unsigned | YES  |     | NULL    |                |
| num_points | int(10) unsigned | YES  |     | NULL    |                |
| lat_deg    | float            | YES  |     | NULL    |                |
| lat_min    | float            | YES  |     | NULL    |                |
| long_deg   | float            | YES  |     | NULL    |                |
| long_min   | float            | YES  |     | NULL    |                |
| bearing    | float            | YES  |     | NULL    |                |
| pitch      | float            | YES  |     | NULL    |                |
| roll       | float            | YES  |     | NULL    |                |
| heave      | float            | YES  |     | NULL    |                |
| tide       | float            | YES  |     | NULL    |                |
| hour       | int(10) unsigned | YES  |     | NULL    |                |
| min        | int(10) unsigned | YES  |     | NULL    |                |
| sec        | int(10) unsigned | YES  |     | NULL    |                |
| day        | int(10) unsigned | YES  |     | NULL    |                |
| month      | int(10) unsigned | YES  |     | NULL    |                |
| year       | int(10) unsigned | YES  |     | NULL    |                |
| posx       | float            | YES  |     | NULL    |                |
| posy       | float            | YES  |     | NULL    |                |
| pingtime   | int(10) unsigned | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+
22 rows in set (0.02 sec)

and:

mysql> show columns from point;
+----------+------------------+------+-----+---------+----------------+
| Field    | Type             | Null | Key | Default | Extra          |
+----------+------------------+------+-----+---------+----------------+
| point_id | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| ping_id  | int(10) unsigned | NO   |     | NULL    |                |
| x        | float            | NO   |     | NULL    |                |
| y        | float            | NO   |     | NULL    |                |
| texture  | int(10) unsigned | NO   |     | NULL    |                |
| fish     | int(10) unsigned | NO   |     | NULL    |                |
+----------+------------------+------+-----+---------+----------------+

Ping_id for the table ping is unique. However ping_id for point is not. IE there are several points for each ping_id. I need to select data so that there is several x,y columns for each ping (number of points are not constant). IE, I am looking for an output that looks like this:

+----------+------------------+-----------+-----+-----+----+------+----+----+-----+----+
| ping_id  | lat_deg          | lon_deg    | x1 | y1  | x2 | y2   | x3 | y3 | x4 | y4 | 
+----------+------------------+------------+-----+-----+----+-----+----+----+----+-----+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:31:05+00:00Added an answer on May 27, 2026 at 8:31 am

    You should join tables:

    SELECT pg.ping_id, lat_deg, long_deg, p.x, p.y 
    FROM ping pg 
    JOIN point p ON p.ping_id = pg.ping_id
    

    and process results to get grouped points for example in PHP:

    $pings = array();
    foreach($results as $row){
      $pings[$row['ping_id']][] = $row;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have two tables: mysql> show columns from profiles; +--------------+--------------+------+-----+---------+----------------+ | Field |
Let's say I have two tables: Table: Color Columns: Id, ColorName, ColorCode Table: Shape
Say we have two tables: table1 (id, name, type) where id is a primary
Say I have two tables: object id name object_event id object_id type date I
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer
Say I have two tables, Parent and Child. Parent has a MaxChildren (int) field
Let's say I have two tables: Table 1 has the columns NOTE_ID (a unique
Say I have two tables I want to join. Categories: id name ---------- 1
Say we have two tables in an MS Access db: Service Users: | ID
Say I have two tables called A (fields: id, phase, name) and B(fields: id,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.