I need some help with a select statement. Have been playing with this all afternoon and cannot get it to work. It seems like it should be relatively straightforward, but I usually only do basic SQL statement stuff, so not sure best way to approach this.
I have two tables, Table A has all the data and Table B is for comments and has 2 columns, the ID column and comment column. I need to create a SQL statement to display all the rows from Table A where the status = 'A' and also display the comments from Table B. Not all the rows will have comments and I have only been able to do this if the row has a comment. Anything else I try will list the rows with status ='A' once for every comment in Table B.
Any suggestions on how to do this.
Basically I want something like: SELECT * from A,B where A.status = 'A' or A.id = B.id
but when I try this I get the duplicates
I have two tables, Table A has all the data and Table B is for comments and has 2 columns, the ID column and comment column. I need to create a SQL statement to display all the rows from Table A where the status = 'A' and also display the comments from Table B. Not all the rows will have comments and I have only been able to do this if the row has a comment. Anything else I try will list the rows with status ='A' once for every comment in Table B.
Any suggestions on how to do this.
Basically I want something like: SELECT * from A,B where A.status = 'A' or A.id = B.id
but when I try this I get the duplicates