• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

DISTINCT MySQL Issues

LEGEND ,
Oct 06, 2007 Oct 06, 2007

Copy link to clipboard

Copied

I am trying to pull only one record per MLSNumber using DISTINCT for MySQL,
but it isn't working. What am I doing wrong? Also, is there a way to pull
the most recent record of the 2+ based on PostDate?

Select
DISTINCT(MLSNumber),PhotoURL,ListPrice,City,PropertyID,ListOfficeId,PropertyType
FROM property WHERE ListOfficeId = 340169

--
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126


TOPICS
Advanced techniques

Views

208

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 06, 2007 Oct 06, 2007

Copy link to clipboard

Copied

select blah blah
from property join
(select max(postdate) maxdate
from property
where listofficeid = 340169 ) x on postdate = maxdate
where listofficeid = 340169

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 06, 2007 Oct 06, 2007

Copy link to clipboard

Copied

How can this be editted to select the Distinct MLSNumber and display the one
with the most current date?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 07, 2007 Oct 07, 2007

Copy link to clipboard

Copied

LATEST
Put "WHERE ListOfficeId = 340169" in the main query and the subquery.
or something like that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation