Combine colums from table return multiple times the same record

yaylitzis

I have 2 tables INVENTORY and PRODUCTS and I want to select some columns of the INVENTORY and one from the PRODUCTS. I wrote:

SELECT INVENTORY.product, INVENTORY.version, PRODUCTS.customer
FROM INVENTORY
INNER JOIN PRODUCTS ON
INVENTORY.product = PRODUCTS.product AND INVENTORY.version= PRODUCTS.version

and I get multiple times the same records.. How I fix it?

sagi

Simple distinct or group by:

SELECT DISTINCT INVENTORY.product, INVENTORY.version, PRODUCTS.customer
FROM INVENTORY
INNER JOIN PRODUCTS ON
INVENTORY.product = PRODUCTS.product AND INVENTORY.version= PRODUCTS.version

Or :

SELECT INVENTORY.product, INVENTORY.version, PRODUCTS.customer
FROM INVENTORY
INNER JOIN PRODUCTS ON
INVENTORY.product = PRODUCTS.product AND INVENTORY.version= PRODUCTS.version
GROUP BY INVENTORY.product, INVENTORY.version, PRODUCTS.customer

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Combine multiple rows in one from same table

From Dev

Combine multiple rows in one from same table

From Dev

SQL: select the same column multiple times from a table

From Dev

Referencing records from the same table multiple times in a join query?

From Dev

Query same table multiple times

From Dev

Joining same table multiple times

From Dev

join same table multiple times

From Dev

Query same table multiple times

From Dev

mysql - select multiple colums value from two table

From Dev

mysql - select multiple colums value from two table

From Dev

Propel returning same record multiple times

From Dev

ADODB/Access: Update Multiple Fields from Record in Same Table

From Dev

Combine Multiple MySQL Queries on the Same Table Into One

From Dev

Querydsl join on same table multiple times

From Dev

adding the same actor multiple times to a table

From Dev

Inner Joining the same table multiple times

From Dev

MYSQL Join Multiple times on same table

From Dev

Left joining same table multiple times

From Dev

Selecting two columns in same table multiple times

From Dev

Joining same table multiple times is throwing error

From Dev

Joining table displays same entry multiple times

From Dev

How to return the last record in a table with multiple states

From Dev

Merging multiple rows from one table into multiple colums in a SQL Query Result Set

From Dev

Adds same record multiple times to database instead of just once

From Dev

How to combine two results from same table

From Dev

Inner join multiple times on same table on same column

From Dev

Subquery to return multiple columns from newest record?

From Dev

I am trying update multiple values from another table by multiple the two colums of two table on th basis of date and symbol

From Dev

I am trying update multiple values from another table by multiple the two colums of two table on th basis of date and symbol

Related Related

  1. 1

    Combine multiple rows in one from same table

  2. 2

    Combine multiple rows in one from same table

  3. 3

    SQL: select the same column multiple times from a table

  4. 4

    Referencing records from the same table multiple times in a join query?

  5. 5

    Query same table multiple times

  6. 6

    Joining same table multiple times

  7. 7

    join same table multiple times

  8. 8

    Query same table multiple times

  9. 9

    mysql - select multiple colums value from two table

  10. 10

    mysql - select multiple colums value from two table

  11. 11

    Propel returning same record multiple times

  12. 12

    ADODB/Access: Update Multiple Fields from Record in Same Table

  13. 13

    Combine Multiple MySQL Queries on the Same Table Into One

  14. 14

    Querydsl join on same table multiple times

  15. 15

    adding the same actor multiple times to a table

  16. 16

    Inner Joining the same table multiple times

  17. 17

    MYSQL Join Multiple times on same table

  18. 18

    Left joining same table multiple times

  19. 19

    Selecting two columns in same table multiple times

  20. 20

    Joining same table multiple times is throwing error

  21. 21

    Joining table displays same entry multiple times

  22. 22

    How to return the last record in a table with multiple states

  23. 23

    Merging multiple rows from one table into multiple colums in a SQL Query Result Set

  24. 24

    Adds same record multiple times to database instead of just once

  25. 25

    How to combine two results from same table

  26. 26

    Inner join multiple times on same table on same column

  27. 27

    Subquery to return multiple columns from newest record?

  28. 28

    I am trying update multiple values from another table by multiple the two colums of two table on th basis of date and symbol

  29. 29

    I am trying update multiple values from another table by multiple the two colums of two table on th basis of date and symbol

HotTag

Archive