Use Array/variable In Sql-query
I'm sure there is a way to do it but I don't know it anymore... I have one big table with all the data. In the table I have rows with information in: columnA1: groupName co
Solution 1:
Try this:
SELECT T2.name,T1.groupName
FROM Table1 T1 INNER JOIN
Table1 T2 on T1.groupID=T2.groupId2
WHERE T2.category=1
Result:
NAME GROUPNAME
Paul IT
Bob IT
An HR
See result in SQL Fiddle
Solution 2:
you could try this:
SELECT DISTINCT A.Groupname, B.name
FROM tablename A
JOIN tablename B ON A.GroupID = B.GroupID
Post a Comment for "Use Array/variable In Sql-query"