Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 ACCESS IS USED, SQL Statement?

Author  Topic 

MikeB
Constraint Violating Yak Guru

387 Posts

Posted - 2003-10-23 : 14:05:36
tblOne
LoadNumber

tblTwo
LoadNumber | Component
1 | B-1

tblThree
LoadNumber | Component
1 | 401
1 | 402

SELECT tblTwo.Component, tblThree.Component
FROM tblTwoComponent, tblThreeComponent
WHERE tblTwo.LoadNumber = 1 OR tblThree.LoadNumber = 1

This returns:
B-2 401
B-2 402

I need it to return
B-2
401
402

How can this be achieved or is two separate SQL calls neccessary?

MikeB

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-23 : 14:12:54
Can you use a UNION in Access?

SELECT tblTwo.Component
FROM tblTwoComponent
WHERE tblTwo.LoadNumber = 1
UNION
SELECT tblThree.Component
FROM tblThreeComponent
WHERE tblThree.LoadNumber = 1

Tara
Go to Top of Page

MikeB
Constraint Violating Yak Guru

387 Posts

Posted - 2003-10-23 : 14:26:07
WHY YES YOU CAN!!!! THANK YOU

I will probably have more questions, but thank you very much for such a quick responce!

Thank you
Mike B
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-23 : 14:29:16
I don't know Access, so hopefully any future solutions for you will be able to be used in Access. Other members here have a bit of Access experience though.

Tara
Go to Top of Page
   

- Advertisement -