Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the difference between two tables in mySQL 1

Status
Not open for further replies.

sbayter

IS-IT--Management
Joined
Nov 14, 2002
Messages
95
Location
CO
Hi,
I have a survey which have 2 tables, one with the results which has a the client reference number in front of each result. Somethign like this.
__________________________________
|ID | QUESTION | RESULT | CLIENTREF |
----------------------------------------------
|1 | satisfied | 10 | 9887 |

The other has the list of client which are supposed to fill out the survey.
I was able to generate a list of the clients that finished the survey by sorting by the last question.
Now, I need to generate a list of the clients that haven't completed the survey but have no clue of how to.
Any suggestions?
Thanks,


sbayter
 
Assuming that the CLIENTREF column is the one common to both tables, and assuming that the list of all clients is "tableA" and the list of all client survey results is "tableB", then something like:

SELECT * from
tableA left join tableB
on tableA.CLIENTREF = tableB.CLIENTREF
where is null QUESTION

should do it


Want the best answers? Ask the best questions: TANSTAAFL!
 
Hi,
Thanks for you help, this is what I got.
[red]"You have an error in your SQL syntax near 'is null QUESTION' at line 1" [/red]

sbayter
 
I thought so but when I tried I got the right number of row but EMPTY.
Are clue why?

sbayter
 
I don't know but I compared the tables manually and counter the rows and it is 3. When I go and run the query it displays the 3 rows but without the client reference inside the fields.
I looks like if the background color was the same as the font. (of course it isn't;))


sbayter
 
I cannot comment. I have no idea how your code works. My general advice is start simple and add complexity later.

With that advice in mind, if you plug the query into your preferred MySQL management console, do you get the values you expect?

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top