Tuesday 15 May 2012

sql - Incorrect use of DISTINCT -



sql - Incorrect use of DISTINCT -

i have form view displays listingid, propertyid, listingagentid, salestatusid, endlistdate , askingprice database in sql.

i have dropdownlist displays lastnames of agents when selected returns relevent info in formview corresponding selection.

it's working, problem each lastly name in dropdownlist duplicated each have more 1 listing. need when selecting 1 lastly name dropdownlist returns 1 value in formview, while beingness able utilize paging view different listings agent.

the code in formview is:

select[listingid], [propertyid], [listingagentid], [salestatusid], [endlistdate], [askingprice] [listings] ([listingid] = @listingid)

the code in dropdownlist is:

select agents.lastname, listings.listingid, listings.propertyid, listings.listingagentid, listings.salestatusid, listings.beginlistdate, listings.endlistdate, listings.askingprice agents inner bring together listings on agents.agentid = listings.listingagentid

where ever seek , set distinct function returns error or doesn't work

thanks

for dropdown need id value , lastname display.

select distinct agents.lastname agents inner bring together listings on agents.agentid = listings.listingagentid

sql visual-studio-2012 distinct

No comments:

Post a Comment