SQL Join Tables and Inner Joins? -


i have 3 tables. products, steps , pictures.

  • products fields: id, name
  • steps fields: id, productid, description
  • pictures fields: id, stepid, picture

i'm working microsoft visual studio , razor i'm using example urldata load correct tables , fields in db. www.example.com/id=1 (shows product #1)

var productid = urldata[0].asint(); var product = db.querysingle("select * steps id = @0", productid); 

i have been able pull data wanted display problem im using simple +1 urldata or -1 urldata go next step or backwards. not work if step deleted , website not stop @ end of steps product.

i'm @ point believe need use join tables need display data above 3 tables using urldata.

i have created test join table ex: "jointest" fields: id, pictureid, stepid, productid

how query table display of data above in first paragraph?

more examples of razor queries:

string description = product.description; var step = db.querysingle("select * products id = @0", product.productid); var steps = db.query("select id, stepname steps productid = @0", productid).tolist(); var photos = db.query("select id, filetitle pictures stepid = @0", productid).tolist(); 

you don't need add new table this. new field nextstepid or stepseqnum existing steps table. need add current step url.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Add class to another page attribute using URL id - Jquery -