asp.net - SQL Query - SELECT WHERE Table1.ID = Table2.ID AND Table2.Var = @Var -


i trying create sql query asp net drop down list using 2 tables , session variable.

i want retrieve values table 1 correspond matching ids in table 2, table 2 filtered external variable.

as clear not know how word question, here simplified example of attempting do:

  • my site has session variable holds current colour user "filtering".
  • a dropdown list show list of cars corresponding colour using sql query.

for example if session variable "blue" dropdown list contain "punto" can see colour id "blue" 12 , "punto" car name corresponding colour.

linked image: http://i.imgur.com/fe9l12c.png

enter image description here

as session variables can assigned , called in asp net custom queries session variable can referred as, example, @externalvar (colours.id (colours.name = @externalvar))

apologies had word quiz question; giving simplified example way articulate question.

i think should trick if understand question above

select * cars c inner join colours cl  on c.colourid = cl.id cl.name = @externalvar 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -