Another MySQL question I have (wish my SQL knowledge was better).

I want to compare a column in one table to two columns put together in another table. For simplicity sake: Table A has columns X and Y, Table B has column Z. The values in X and Y put together are the values in Z.

Example:

Table A                    Table B
         X     Y     stuff          Z     stuff
         -----------------          -----------
         10    67    abc            1067  xyc

My WHERE clause needs to be Where (A.X and A.Y concatenated) = B.Z

Any suggestions?

You mean like this:

Select 
tableb.stuff, tablea.stuff 
from tableb
join tablea on tableb.z = concat(tablea.x, tablea.y)

This would give you the stuff fields from both tables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.