Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2015
    Posts
    2

    Exclamation Unanswered: MySQL: Merging two column as one and excluding the duplicate values

    I have successfully queried from a database following records, but I need merge both the block_user and block_by as one single column. how can i do so?

    Code:
    SELECT * 
    	FROM (
    		SELECT * 
    			FROM block_list
    		UNION 
    		SELECT * 
    			FROM block_list
    		) AS block
    		WHERE (block.block_user =  33 OR block.block_by =  33)

    Click image for larger version. 

Name:	Screen Shot 2015-06-22 at 8.48.08 am.png 
Views:	5 
Size:	46.4 KB 
ID:	16413

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I can't understand what you want to do. Please explain it another way, and provide examples (sample data with your desired results) so that we can help you.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jun 2015
    Posts
    2

    I want the results something as following

    I want the results something as following, with a single field (the field title can be anything)

    Click image for larger version. 

Name:	Screen Shot 2015-06-22 at 8.48.08 am.png 
Views:	5 
Size:	37.0 KB 
ID:	16414

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Ok, that helps a little bit.

    For the set of data:
    Code:
    Block_Id Block_User
    10       10
    10       11
    10       12
    11       10
    11       11
    11       12
    12       10
    12       11
    12       12
    What results do you want to return?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •