VB.net SQL

I have 3 Tables -   Accounts, Stock, Customers
Accounts - Fields
Invoice,Name,Edited

Stock - fields
Stocknumber, name, edited

Customers - fields
Customerno, name, edited

I want to run a sql to create a table all String fields to have
Field1,field2,field3,Field4

accounts then
field1 = ‘A’,field2 = Invoice, Field3 = Name, Field4 = edited

Stock then
field1 = ‘S’,field2 = Stockno, Field3 = Name, Field4 = edited

Customers then
field1 = ‘C’,field2 = CustomerNo, Field3 = Name, Field4 = edited

something like
Select
‘A’ as Field1 (if stock then Field1 = 'S')
,a.Invoice as Field1
,a.Name as Field2
a.Edited as Field3
from Accounts as a
then how do you add the other table data without losing the accounts data
KevinfeeningAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try:

select 'A' as yourField, Invoice,Name,Edited from Accounts
union all
select 'S' as yourField, Stocknumber, name, edited from Stock
union all
select 'C' as yourField, Customerno, name, edited from Customers

Open in new window


or

select 'A' as yourField, Invoice,Name,Edited from Accounts
union
select 'S' as yourField, Stocknumber, name, edited from Stock
union
select 'C' as yourField, Customerno, name, edited from Customers

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
KevinfeeningAuthor Commented:
Thanks hadn't used Union before
excellent
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
Visual Basic.NET

From novice to tech pro — start learning today.