problem med sql
Jeg bruger følgende sql:SQLstmt = "SELECT "
SQLstmt = SQLstmt & "(articles.stock - (SELECT amount FROM cartitems WHERE articleid LIKE articles.id AND cartid LIKE '" & session("cartid") & "')) AS CurrentStock, "
SQLstmt = SQLstmt & "id, subid, product, content, price, dilevery, sale, stock_sale, sale_price, sale_start, sale_end, sale_pieces, discount, stock, image "
SQLstmt = SQLstmt & "FROM articles WHERE subid LIKE '" & strId & "' AND stock > 0 ORDER BY content"
Set RSList = sConn.Execute(SQLstmt)
Men kunne godt tænke mig at få det til at virke så det istedet for stock er Currentstock > 0...altså i den her stil:
SQLstmt = "SELECT "
SQLstmt = SQLstmt & "(articles.stock - (SELECT amount FROM cartitems WHERE articleid LIKE articles.id AND cartid LIKE '" & session("cartid") & "')) AS CurrentStock, "
SQLstmt = SQLstmt & "id, subid, product, content, price, dilevery, sale, stock_sale, sale_price, sale_start, sale_end, sale_pieces, discount, stock, image "
SQLstmt = SQLstmt & "FROM articles WHERE subid LIKE '" & strId & "' AND Currentstock > 0 ORDER BY content"
Set RSList = sConn.Execute(SQLstmt)
Men uanset hvordan jeg har forsøgt at stille det op kommer den enten med en fejl eller den viser slet ingen poster. Er der en smart måde man kan skrive koden om på eller hvad?