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 8895777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:52:39+00:00 2026-06-14T23:52:39+00:00

Is there a way to select only the rows that have an other result

  • 0

Is there a way to select only the rows that have an other result than the row previous selected?
In one of my tables I store advertisement data, that’s one row per advertisement. I also store in an other table the prices for rental per dag, week, month, this table contain more than one row per advertisement.
I want to select al the rows from table 2 where there is a change in one of the prices (in the example row 1 and 3 in table 2) in the same query as the data selection. I know that I have to use a GROUP_CONCAT to get one row instead of a 2 row result in this case, but how to get 2 result rows from table 2 and 1 result row in total?

The outcome of the query has to be something like: tre,234,” 12345678911,12,45, 32555678911,12,67 ”

Table 1 (advertisements)
ID_adv      data1       data2   
1       tre     234
2       ghj     34
3       jk      098 
4       jfjk        12

Table 2 (dates)
ID_dates    ID_adv      timestamp_day   price1      price2
1       1       12345678911     12      45
2       1       22345677771     12      45
3       1       32555678911     12      67
4       2       42345671231     34      34

I tried

SELECT 
t1.*, 
GROUP_CONCAT(t2.date) AS dates 
FROM Table1 t1 
LEFT JOIN Table2 t2 ON t2.ID_adv = t1.ID_adv 
WHERE t1.ID_adv = 3 GROUP BY t1.ID_adv
  • 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-06-14T23:52:40+00:00Added an answer on June 14, 2026 at 11:52 pm

    Can you try this one:

    SELECT T3.ID_adv
        , T3.data1
        , T3.data2
        , CAST(GROUP_CONCAT(CONCAT(T3.timestamp_day, ',', T3.price1, ',', T3.price2)) AS CHAR) AS DatePrice
        FROM (
            SELECT T1.*
                , MIN(T2.timestamp_day) AS timestamp_day
                , T2.price1
                , T2.price2
                FROM Table1 T1
                LEFT JOIN Table2 T2 ON T2.ID_adv = T1.ID_adv
                GROUP BY T1.ID_adv, T2.price1, T2.price2
        ) T3
        GROUP BY T3.ID_adv;
    

    I’ve tried it on SQL Fiddle.

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

Sidebar

Related Questions

Is there any way to select only innermost tables? That is ones that do
I was wondering if there was a way to select only certain values in
Is there any way to select items in a list that aren't contained in
I was wondering if there is a way to filter rows which have a
Is there a way to select all id's with jQuery with a prefix my
Is there a way to select the jQuery active tab with a HTML propertys.
Is there a way to select all the contents of a node in Nokogiri?
Is there a way to select all columns of a data frame except a
1) Is there any way to select a random record from Freebase? If I
In a jquery modal dialog, is there a way to select a button as

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.