Hi all, I have a little doubt about the construction of a SQL Query.
I have a Table ART (with id and name fields), a table DESCR (with id and name) and a table ARTDESCR (with artid and descrid).
Table Art looks like (Data is irrelevant)
1 Edit1
2 Edit2
3 Edit3
4 Edit4
5 Edit5
6 Edit6
7 Edit7
Table Descr, looks like
1 Archivistica
2 Documentación
3 Achilipu
4 Grome nagüer
5 Edit6
And table ArtDescr looks like (ARTID, DESCRID)
1 1
1 2
2 1
2 4
3 3
4 1
4 2
5 1
5 2
5 4
7 1
7 3
I need, to get the ARTS, having a ARTDESCR record with DescrID equal to 1 or 2, for example
SELECT Articulos.NombreArt FROM ARTICULOS, ARTDESCR
where (Articulos.ARTID=ARTDESCR.ARTID and (ARTDESCR.DESCRID = 1 OR ARTDESCR.DESCRID = 2))
group by NombreArtThis works, and it's ok, but, I'm having problems with the next "option"
I need, to get the ARTS, who has ARTDESCR records with DescrID equal to 1 AND 2
This means, it's suppose to get only, Edit1, Edit4 and Edit5, but I can't get the right SQL to get it, and this does'nt works
SELECT Articulos.NombreArt FROM ARTICULOS, ARTDESCR
where (Articulos.ARTID=ARTDESCR.ARTID and (ARTDESCR.DESCRID = 1 AND ARTDESCR.DESCRID = 2))
group by NombreArtA lot of time away from SQL.
