再问几个查询语句的问题,100分
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice FROM Authors INNER JOIN BookAuthor ON Authors.PKId = BookAuthor.AuthorId INNER JOIN Books ON BookAuthor.ItemId = Books.ItemId INNER JOIN Items ON Books.ItemId = Items.PKId WHERE (Items.Name ='abc')
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items INNER JOIN Authors ON Authors.PKId = Items.PKId WHERE (Authors.Name like '%abc%')
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items INNER JOIN Books ON Items.PKId = Books.ItemId WHERE (Books.ISBN ='')
哪位大哥帮忙转成acess数据库的查询语句,万分感谢
问题点数:0、回复次数:12Top
1 楼jackymi(完美刺客)回复于 2004-12-03 08:48:44 得分 0
access不支持sqlTop
2 楼landlordh(work wonders)回复于 2004-12-03 08:49:43 得分 0
以上應該可以去掉()
不行的話,試下這個
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice FROM Authors,BookAuthor,Books,Items where Authors.PKId = BookAuthor.AuthorId and BookAuthor.ItemId = Books.ItemId and Books.ItemId = Items.PKId and Items.Name ='abc'
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items,Authors where Authors.PKId = Items.PKId and Authors.Name like '%abc%'
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items,Books where Items.PKId = Books.ItemId and Books.ISBN =''
Top
3 楼zhanqiangz(闲云野鹤-Overriding)回复于 2004-12-03 08:57:57 得分 0
sql是一种表中,虽然不能数据库产品可能会有差异,但是access一样支持sql.用where连接试试。
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice FROM Authors ,BookAuthor,item ,books where Authors.PKId =BookAuthor.AuthorId and BookAuthor.ItemId = Books.ItemId and Books.ItemId = Items.PKId and Items.Name ='abc'
Top
4 楼zhanqiangz(闲云野鹤-Overriding)回复于 2004-12-03 08:59:07 得分 0
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items ,Authors where Authors.PKId = Items.PKId and Authors.Name like '%abc%'
Top
5 楼zhanqiangz(闲云野鹤-Overriding)回复于 2004-12-03 08:59:56 得分 0
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items , Books where Items.PKId = Books.ItemId and Books.ISBN =''
Top
6 楼johnsuna(缘来是e)回复于 2004-12-03 08:59:57 得分 0
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice FROM Authors a,BookAuthor ba,Books b,Items i where a.PKId = ba.AuthorId and ba.ItemId = b.ItemId and b.ItemId = i.PKId WHERE i.Name ="abc"
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items,Authors where Authors.PKId = Items.PKId and Authors.Name like "%abc%"
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice FROM Items,Books where Items.PKId = Books.ItemId and Books.ISBN =""Top
7 楼litp(天道酬勤)回复于 2004-12-03 09:04:08 得分 0
access当然支持sql
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice
FROM Authors ,BookAuthor,Books,Items
where (Authors.PKId = BookAuthor.AuthorId) and (BookAuthor.ItemId = Books.ItemId)
and (Books.ItemId = Items.PKId) and (Items.Name ='abc')
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice
FROM Items ,Authors
where Authors.PKId = Items.PKId and Authors.Name like '%abc%'
SELECT Items.Name, Items.ImageFileSpec, Items.UnitPrice
FROM Items , Books
where Items.PKId = Books.ItemId and (Books.ISBN ='')Top
8 楼lily4064(忘忧草)回复于 2004-12-03 09:08:00 得分 0
呵呵,改成这样的。
select Items.Name,books.ISBN,Authors.Name as Authors,Items.Unitprice from Authors,BookAuthor,books,Items where Authors.PkId=BookAuthor.AuthorId and BookAuthor.ItemId=Books.ItemId and Books.ItemId=Items.PKId and Items.Name='abc'
select Items.Name,Items.ImageFileSpec,Items.UnitPrice from Items,Authors where Authors.PkId=Items.PkId and Authors.Name like '%abc%'
select Items.Name,Items.ImageFileSpec,Items.unitprice from Items,Books where Items.PkId=Books.ItemId and Books.ISBN=''Top
9 楼dragonforfly(飘零)回复于 2004-12-03 09:13:03 得分 0
Access支持SQL,我以前用Access和VBA编程的,SQL Server的SQL语句直接复制过去,改动一点就可以用了,有时都不需要改动.
你复制到Access里慢慢调试吧Top
10 楼nhf80649(懒星星)回复于 2004-12-03 09:44:34 得分 0
SELECT Items.Name, Books.ISBN, Authors.Name AS Authors,Items.UnitPrice FROM Authors INNER JOIN BookAuthor ON Authors.PKId = BookAuthor.AuthorId INNER JOIN Books ON BookAuthor.ItemId = Books.ItemId INNER JOIN Items ON Books.ItemId = Items.PKId WHERE (Items.Name ='abc')
SELECT Name, ImageFileSpec, UnitPrice FROM Items INNER JOIN Authors ON Authors.PKId = Items.PKId WHERE (Authors.Name like '%abc%')
SELECT Name, ImageFileSpec, UnitPrice FROM Items INNER JOIN Books ON Items.PKId = Books.ItemId WHERE (Books.ISBN ='')
直接就可以的~~~
Top
11 楼snowpine999([彼岸烟花][当你看到☆河灿烂,可会想起我?])回复于 2004-12-03 10:02:19 得分 0
access和sql
都是微软的东东吧 怎么可能不支持?Top
12 楼YapEro([::q^-^p::])回复于 2004-12-03 11:50:52 得分 0
这些语句在access中直接就可以用啊.
sql和access只是日期数据类型时有些不同,其他语法都是一样.另外sql比access多了些函数Top




