I had posted a few days ago on this topic, but I am not sure I was very specific. I have two tables I am trying to pull some data from. This is for a report the tables and data I need are this.
Table 1
attribute_ID
attribute_name
Table 2
Attribute_ID
Attribute_name
Attribute Info
Attribute Info
Attribute Info
Attribute Info
The information I am trying to get is all in the attribute info field. Each field has the same attribute ID from table 1. I am going to have to tell it that I need attribute info where it = X and where it = Y and where it = Z and where it = W. My report has the following columns. ID, Name, Job1, Job2, Job3, Job4. I didn't know the best way. Would I do something like this?
SELECT ID, NAME, A.ATTRIBUTE_INFO , B. ATTRIBUTE_INFO, C. ATTRIBUTE_INFO , D. ATTRIBUTE_INFO
FROM TABLE 1, TABLE 2
JOIN TABLE1 ID ON TABLE 2 ID
WHERE A.ATTRIBUTE_INFO=W AND B.ATTRIBUTE_INFO=Y AND C.ATTRIBUTE_INFO=X AND D.ATTRIBUTE_INFO=Z
My report should look like this:
ID Name Job1 Job2 Job3 Job4
1221 Ross X Y Z W
My table looks like this:
ID | Attribute_info | date | time | rim
1221| x | 04/04 | 12 | 9
1221| y | 04/04 | 12 | 9
1221| z | 04/03 | 01 | 3
1221| w | 03/13 | 09 | 1
1221| loading | 02/01| 04 | 9
1221| SQL? | 04/19| 03 | 2
I only need the rows that have x,y z and w. Does this make sense? I tried to explain it a little better