I have Two tables named
1.Categortable Category Mouse Computer Electronics
and the second table Texttable
category Text Mouse Logitech Mouse Computer LG Computer Electronics LG Electronics
Here I need To select Text for each category in Categortable from Texttable
Can any one help how to loop this to get the output.
No need to do any looping here, a simple
JOIN should work for you:
SELECT * FROM CategoryTable CT LEFT JOIN TextTable TT ON CT.Category = TT.Category
I've used a
LEFT JOIN in case you want to return rows from your Category table which don't have a corresponding match in the Text table.
In case you only want the matching records, just replace the
LEFT JOIN with an