By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,477 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,477 IT Pros & Developers. It's quick & easy.

complex query challenge

P: n/a
Hello everybody,
I'd like to be guide to do that:

I have 2 tables [In Access 2002]:

---------------- ----------------
| Table_1 | | Table_2 |
---------------- ----------------
| DIV | ST | | SID | DIV |

I need to make a query to retrieve 2 columns:
The first one will display absolutly all the pd's from
(SELECT pd FROM Table_1 WHERE St = 'AV')
The second one will show (null or not null values) from
(SELECT div FROM Table_2 WHERE sid = 'T26')
I want to know what DIV's from the Table_1 are used in the Table_2.
Something like this:

| DIV |Exist|
200 X
300
400
500 X
600

Thanks
Jan 25 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
CenturionX wrote:
Hello everybody,
I'd like to be guide to do that:

I have 2 tables [In Access 2002]:

---------------- ----------------
| Table_1 | | Table_2 |
---------------- ----------------
| DIV | ST | | SID | DIV |

I need to make a query to retrieve 2 columns:
The first one will display absolutly all the pd's from
(SELECT pd FROM Table_1 WHERE St = 'AV')
The second one will show (null or not null values) from
(SELECT div FROM Table_2 WHERE sid = 'T26')
I want to know what DIV's from the Table_1 are used in the Table_2.
Something like this:

| DIV |Exist|
200 X
300
400
500 X
600

Thanks
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not sure what you want since you give 3 examples of possible solutions.
What DIVs from T1 are used in T2:

SELECT T2.Div
FROM Table_2 As T2 INNER JOIN Table_1 As T1 ON T2.div=T1.div

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBR5pcfoechKqOuFEgEQJ0iQCg4gTmZwSp6JqB+h8e9qXYkR guBSgAn0aL
WLSgkld3QGLwI/jgyoudqiFl
=puZ/
-----END PGP SIGNATURE-----
Jan 25 '08 #2

P: n/a
Try.

SELECT Table_1.DIV, IIf([Table_2].[DIV],"X") AS Exist
FROM Table_1 LEFT JOIN Table_2 ON Table_1.DIV = Table_2.DIV;

Jørn

"CenturionX" <da************@gmail.comskrev i en meddelelse
news:c9**********************************@v46g2000 hsv.googlegroups.com...
Hello everybody,
I'd like to be guide to do that:

I have 2 tables [In Access 2002]:

---------------- ----------------
| Table_1 | | Table_2 |
---------------- ----------------
| DIV | ST | | SID | DIV |

I need to make a query to retrieve 2 columns:
The first one will display absolutly all the pd's from
(SELECT pd FROM Table_1 WHERE St = 'AV')
The second one will show (null or not null values) from
(SELECT div FROM Table_2 WHERE sid = 'T26')
I want to know what DIV's from the Table_1 are used in the Table_2.
Something like this:

| DIV |Exist|
200 X
300
400
500 X
600

Thanks

Jan 26 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.