query Syntax

Hi all:
I've one table consists of 6 column (xdate, trno, servtype, vendor, customer, usersign).

first table
and 3 vendors table (tktvendor, bookingvendor, insuranceVendor).

i would like to join between the first table and the three vendors table according to field "servtype" value
if  servtype=1 i would like to join tktvendor
if  servtype=2 i would like to join bookingvendor
if  servtype=3 i would like to join insuranceVendor
khaled salemSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AshokSr. Software EngineerCommented:
It looks like all fields in the Grid come from the first table.

Is that correct?
khaled salemSoftware DeveloperAuthor Commented:
No. I would like to join with vendorName in each table .
AshokSr. Software EngineerCommented:
VendorName is not in the Grid, but you would like to include it, right?


Is join field vendor (Vendor #)?
From the few facts available, I think this may help:
FROM FIRST_TABLE AS FT --<< you didn't give this name
LEFT JOIN tktvendor       AS VS1 ON ft.vendor = vs1.vendor AND ft.servtype = 1
LEFT JOIN bookingvendor   AS VS2 ON ft.vendor = vs2.vendor AND ft.servtype = 2
LEFT JOIN insuranceVendor AS VS3 ON ft.vendor = vs13vendor AND ft.servtype = 3

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.