Merge 3 Fields - CLOSED

7 replies [Last post]
newtonln
Offline
Last seen: 4 weeks 2 days ago
Title:
Joined: 19 Apr 2016
Posts: 5
Dear Friends I would like to know, how to to a query or a new table, to merge “TABLE”.“COMP1” + “TABLE”.“COMP2” + “TABLE”.“COMP3”. I tried with a hard way, with : 1) Query 1 Group and count for “TABLE”.“COMP1” 2) Query 2 Group and count for “TABLE”.“COMP2” 3) Query 3 Group and count for “TABLE”.“COMP3” 4) Export all queries to Calc 5) Data Pilot 6) Export the results to a new Base table. Is there an “easy way” to solve this situation ? I need only the results, doesn’t matter if by a query/sql or a table! Sincerely, Newton Nickel Curitiba – PR – Brazil
Newton Nickel Curitiba – PR – Brazil
frofa
frofa's picture
Offline
Last seen: 13 hours 17 min ago
Title: ★★★★★
Joined: 24 Feb 2012
Posts: 804
Merge column values - give some example data
Newton:

Would you please give us some EXAMPLE DATA so we can more clearly understand what you want. Show and sample of your INPUT data and then a sample of your OUTPUT data.

newtonln
Offline
Last seen: 4 weeks 2 days ago
Title:
Joined: 19 Apr 2016
Posts: 5
Three Fields
Dear Frofa : AGENTEUM, AGENTEDOIS, AGENTETRES, all VARCHAR. I need a query where CAMPOUM or another alias, is the merge of them. Sincerely, Newton
AttachmentSize
ThreeFields.png 72.9 KB
Results.png 76.84 KB
Newton Nickel Curitiba – PR – Brazil
frofa
frofa's picture
Offline
Last seen: 13 hours 17 min ago
Title: ★★★★★
Joined: 24 Feb 2012
Posts: 804
clearer example screenshots needed please
Newton:

Sorry, but I still cannot understand from your 2 screenshots exactly what you want. (The items in your ThreeFields sceenshot do not seem to match those in your Results screenshot.)

…Group and count…

You obviously have been able to do the THREE (3) INDEPENDENT queries to GROUP and COUNT the data in each of your 3 tables (where is the example for this?), and then you want to MERGE them – but I am not clear what the basis of the MERGE actually is. I think you need to provide a clearer example to show how you want your OUTPUT to look and how it related to the example 3 queries inputs.

newtonln
Offline
Last seen: 4 weeks 2 days ago
Title:
Joined: 19 Apr 2016
Posts: 5
Sample
AGENTEUM : 181 records + AGENTEDOIS : 181 records + AGENTETRES : 181 records. WHAT I NEED, D COLUMN : 543 records.
AttachmentSize
AgentsSample.ods 32.52 KB
Newton Nickel Curitiba – PR – Brazil
frofa
frofa's picture
Offline
Last seen: 13 hours 17 min ago
Title: ★★★★★
Joined: 24 Feb 2012
Posts: 804
Your sample .ods file
Newton:

Despite looking at your SAMPLE .ods file, I’m not sure if I understand what you want. Are you saying you just want to combine the first 3 lists (AGENTEUM, AGENTEDOIS, AGENTETRES) to make one big alpha-SORTED list (without removing repeated entries)? If so, it seems overkill to use Base to do this job.

By the way, I assume your main database is a Base .odb file – are you able to post a SAMPLE file to show how you have setup your form/s, queries.

Please give us some more feedback so we’re on the right track.

newtonln
Offline
Last seen: 4 weeks 2 days ago
Title:
Joined: 19 Apr 2016
Posts: 5
I'm very sorry
We are in a Base Forum… Maybe for language troubles, I’m not express with a better way! Thanks for your help!
Newton Nickel Curitiba – PR – Brazil
F3K Total
Offline
Last seen: 2 weeks 6 hours ago
Title: ★★★★★
Joined: 14 Oct 2013
Posts: 201
Merge 3 Fields
Hello, if you add a primary-key-column ID, then this will work:

SELECT
    AGENTS,
    COUNT(AGENTS) "Cont.Núm - AGENTS"
FROM
    (SELECT ID, "AGENTEUM" AGENTS FROM "TABLE"
        UNION
    SELECT ID,"AGENTEDOIS" FROM "TABLE"
      UNION
    SELECT ID,"AGENTETRES" FROM "TABLE")
GROUP BY
    AGENTS
ORDER BY
    AGENTS

See attachment
R

AttachmentSize
NewtonNickelCuritiba–PR–Brazil.odb 14.58 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.