I got 3 different tables on sql server (attrib,att_art, art). 'attrib' has a list of attributes, 'art' has a list of items and att_art should join both, like this:
ATTRIB
att1
att2
att3
...
ART
ar1
ar2
ar3
...
Both tables have an unique id that joins on att_art on id_att and id_ar
This is what I need to do:
For each item on art and for each attrib at the same time, I need to insert a new row on att_art. Like this:
att1 ar1
att2 ar1
att3 ar1
att4 ar2
att5 ar2
att6 ar2
....
How could I do this? i'm kinda new on sql and it's been overwhelming!
Use Cross apply.............
Select * from ATTRIB a
cross apply (select * from ART) b