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

  • SEARCH
  • Home
  • 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 6361845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:49:47+00:00 2026-05-24T23:49:47+00:00

I’m pulling information that will eventually be from 5 tables at once based off

  • 0

I’m pulling information that will eventually be from 5 tables at once based off of a filtering system. Right now I have three different databases running, its looking great. My issue is I have certain fields that I only want to display distinct information on and others i want to display all. To better explain I’m going to give my example.

My select code:

SELECT w.event,
       w.city,
       w.DATE,
       a.TIME,
       w.tmc,
       a.weather,
       a.surface_temperature,
       p.top,
       p.LEFT
FROM   weather w
       LEFT OUTER JOIN application a
         ON a.DATE = w.DATE
            AND a.tmc = w.tmc
       LEFT OUTER JOIN pinlocations p
         ON w.city = p.cityname
WHERE  w.DATE = '" & datepicker_value.Text & "'
       AND w.TIME LIKE '" & eventTime.SelectedItem.Value & "'  

I have a map which I’m placing pins on based of the p.top and p.left. When I click on this I want to display the city name, the tmc, and then under that all the other information based off the filtered search. In the example above it creates pins on top of pins, making a new one for each field, I want it to be distinct.

I know the distinct command exists, just not sure how to use it in this situation.

Thanks!

  • 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-24T23:49:47+00:00Added an answer on May 24, 2026 at 11:49 pm

    Use a group by modifier, on the values you want to be distinct.
    Then use a group_concat on the values you want to have listed in a comma-separated list.

    SELECT group_concat(w.event) as events,
           group_concat(w.city) as cities,
           group_concat(w.`DATE`) as dates,
           group_concat(a.`TIME`) as times,
           group_concat(w.tmc) as tmcs,
           group_concat(a.weather) as weathers,
           group_concat(a.surface_temperature) as temperatures,
           p.top,
           p.LEFT
    FROM   weather w
           LEFT OUTER JOIN application a
             ON a.DATE = w.DATE
                AND a.tmc = w.tmc
           LEFT OUTER JOIN pinlocations p
             ON w.city = p.cityname
    WHERE  w.DATE = '" & datepicker_value.Text & "'
           AND w.TIME LIKE '" & eventTime.SelectedItem.Value & "'  
    GROUP BY p.top, p.left
    

    If a left-top coordinate only ever links to one city (as you’d expect), there’s no need to put it inside a group_concat statement. Nor does MySQL require* you to put it in the group by clause.

    See:
    http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat

    * ) you can force MySQL do enforce strict group by rules, but by default it is off.

    You cannot use distinct here, because distinct is an all or nothing affair, it operates in the collectivity of all selected values, not just on one field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.