473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

complex query challenge

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
2 1358
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: wiredog | last post by:
I am struggling rewriting my query from MS Access' IIF, Then to SQL Servers TSQL language. I am hoping some one can give me some guidance. I believe I have the first portion of the query correct...
4
by: Starbuck | last post by:
OK, first let me say that I am no DB person. But I have a user here who keeps getting this error whenever she does, whatever it is she does, with databases... A google search takes me to...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
1
by: Randy Volkart | last post by:
I'm trying to fix a glitch in a complex access database, and have a fairly complex problem... unless there's some obscure easy fix I don't know being fairly new with Access. Basically, the area...
5
by: isoquin | last post by:
Given: tblPurchase contains: customerID dtePickup 'estimated date a customer will return to the shop tblPickup contains: dteArrived 'the actual date the customer returned ...
1
by: huffie | last post by:
I'll explain my problem using a little example table article name price ------------------------------- art1 Default 10 art2 Default 15 art2 Egmond 12 art3 Default 20 art3 Windels 17
3
Minion
by: Minion | last post by:
I hate to even post this message as I probably know the answer before I begin. Still there are several problems facing me with this particular challenge. First though I'll goto into the overview...
6
Chrisjc
by: Chrisjc | last post by:
Okay so I think I figured out the question I need to ask one of you enlighten php guys I am in need of a query that will get all fields opened up so duh * ha no but seriously here is the challenge...
0
crystal2005
by: crystal2005 | last post by:
Hi, I am having trouble with some complex SQL queries. I’ve got winestore database, taken from Web Database Application with PHP and MySQL book. And some question about queries as the following ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.