sql - Unable to create a table using query -
sql - Unable to create a table using query -
i trying write query selects view.
create view carrentalhistoryview select c.vehno, c.brand, c.dateregistered, c.purchaseprice, c.rentalcost, c.condition 'before condition', r.condition 'after condtion', r.daterented, r.datereturned, r.custno,cu.name, cu.id, cu.dateofbirth dbo.car c inner bring together dbo.rental r on c.vehno = r.vehno inner bring together dbo.customer cu on cu.custno = r.custno; go this query trying run,
select * dbo.carrentalhistoryview 'before condition' != 'after condition' but query runs fine if case
select * dbo.carrentalhistoryview 'before cion' != 'after ction' so point beingness how can ensure can results of vehicles has different status before. tks!
single quotes (') denote character literals. square braces ([]) denote columns names. view creation should like:
create view carrentalhistoryview select c.vehno, c.brand, c.dateregistered, c.purchaseprice, c.rentalcost, c.condition [before condition], r.condition [afterc ondtion], r.daterented, r.datereturned, r.custno, cu.name, cu.id, cu.dateofbirth dbo.car c inner bring together dbo.rental r on c.vehno = r.vehno inner bring together dbo.customer cu on cu.custno = r.custno ; go now, can query properly:
select * dbo.carrentalhistoryview [before condition] != [after condition] sql tsql
Comments
Post a Comment