Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
means i need 5 values from table 1 and 1 value from table 2 the bold values marked with the '<-- sign having eastern should only display eastern

installation of acess controls	45	10	450	eastern
installation of cctv	        50	        502500   eastern
installation of dual data and voice	25	1002500	eastern '<--
installation of fire alarms	25	20	500	eastern '<--
supply of acess controls	150	10	1500	eastern
supply of cables	        40	3	120	eastern
supply of fire alarms	      40	20	800	eastern
suppy of cctv doom type	     120	50	6000	eastern
Posted
Updated 2-Jun-13 22:53pm
v2
Comments
CHill60 3-Jun-13 4:51am    
What have you tried so far. Use the Improve question link to post your sql query
Sharon 2 3-Jun-13 4:52am    
select distinct Quotation.description,Quotation.Rate,
Quotation.Qty,Quotation.Total, LPOMaster.subname
from Quotation left outer join
LPOMaster on LPOMaster.enqid=Quotation.enqid
where Quotation.enqid=21
Maciej Los 3-Jun-13 4:54am    
Use "Improve question" instead posting new comment.
Use "Reply" to post comment as a reply to others comment.
Do not repost the parts of your question as a comment!

1 solution

If you are returning similar distinct rows after selecting from two tables just use a UNION on the tables.
Duplicate rows will automatically be removed.

E.g.
select A, B from TableA
UNION
select A, B from TableB
 
Share this answer
 
v2
Comments
Sharon 2 3-Jun-13 4:56am    
this is for selecting same number of values know i'm selecting 5 values from table 1 and 1 value from table 2
Abhinav S 3-Jun-13 5:06am    
Are you doing a Join? What is your query?
Sharon 2 3-Jun-13 5:29am    
select distinct Quotation.description,Quotation.Rate,
Quotation.Qty,Quotation.Total, LPOMaster.subname
from Quotation left outer join
LPOMaster on LPOMaster.enqid=Quotation.enqid
where Quotation.enqid=21
Abhinav S 3-Jun-13 5:42am    
Make sure you are joining on the right fields.
Sharon 2 3-Jun-13 5:54am    
yes..my aim to display subname from lpo table for only two description values in quotation table

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900