1
post_id organisation_id
            1   5
            2   57
            3   57
            4   57
            5   58
            6   59
            7   60
            8   61
            8   62
            9   59
            11  57
            12  57
            4   62

is there anyway to select post_id, organisation_id1, organisation_id2 in a single row?

1
  • 1
    Can you show what your expected results would look like? Commented Jan 10, 2011 at 19:43

2 Answers 2

3

Since you didn't specify what your table looks like and what would be the outcome that you would like, this is just a guess.

SELECT
    a.post_id,
    a.organisation_id,
    b.organisation_id
FROM your_table a
LEFT JOIN your_table b
    ON a.post_id = b.post_id AND a.organisation_id < b.organisation_id
Sign up to request clarification or add additional context in comments.

Comments

1

Is this what you're looking for?

select post_id, group_concat(organisation_id)
    from YourTable
    group by post_id;

1 Comment

it returns post_id group_concat(organisation_id) 1 [BLOB - 1B] 2 [BLOB - 2B] 3 [BLOB - 2B] 4 [BLOB - 5B] 5 [BLOB - 2B] 6 [BLOB - 2B] 7 [BLOB - 2B] 8 [BLOB - 5B] 9 [BLOB - 2B] 11 [BLOB - 2B] 12 [BLOB - 2B]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.