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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL query help

Author  Topic 

amitbadgi
Starting Member

29 Posts

Posted - 2005-07-06 : 14:53:12
Thanks for your reply, I shall explain in detail what exactly I am looking for, now I have 4 different cities, each with 2 tables(access), liek this

CityA
Table1
BID MailAddress Telephonenumber
Table 2
BID Licensenumber Transactionamt

CityB
Table1
BID MailAddress Telephonenumber
Table 2
BID Licensenumber Accountnumber

The other 2 cities are similar as above, now I created a form in MSAccess and if I enter a BID the concerned data should show up, like if i enter a BID which belongs to city A then the mail adress, telphoen number and transaction amount should show up and if I enter a BID which belongs to cityB, then the related info should show up, now I have written a query for cityA and is working just fine, but I am not sure on how to combine all the 4 cities in one query, I cannot put everything in one table as some of the fields are different, and when a user enters a BID, he doesnt know to which city that BID belongs to. Some of em have told me to use 5 different forms and soem have told to use union, I am not relly sure as to how to use it, if you could help me out I would be greateful, thanks.

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-07-06 : 15:59:07
You can use pass through parameters and select a city using an if statement to return the correct Select


If @selectcity = A
Begin
Select cola,colb
From YourtableA
End

If @selectcity = b
Begin
Select cola,colb
From YourtableB
End
If @selectcity = C
Begin
Select cola,colb,colZ
From YourtableC
End

If @selectcity = D
Begin
Select cola,colb
From Yourtabled
end


Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -