Link to home
Start Free TrialLog in
Avatar of delimpasis
delimpasis

asked on

SQL Server Construct a view

I have 2 tables in sql server 2005.
Table A has a field 'main_code' and table B has two fields 'main_code' and 'barcode'. The tables have a relationship on the 'main_code' fields.
I need to construct a view that for each record in B will display the 'barcode' field. In case there is no record from table A associated to table B (in other words the product has no barcode) I want to display the 'main_code' field.
ASKER CERTIFIED SOLUTION
Avatar of Anna_R
Anna_R
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of delimpasis
delimpasis

ASKER

It worked. Thank you