Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 query with join

Author  Topic 

ak56s
Starting Member

3 Posts

Posted - 2002-10-28 : 18:40:42
I am doing a query with a join to find everything paula harris and mitch edwards ordered. I can search for only one name at a time, but I can't figure out how to search for both, which Ineed to do. Here is my select statement which works, but I need to be able to search for both names.

select first, last, order_date, item_desc
from customer, cust_order, item, order_line, inventory
where customer.cust_id = cust_order.cust_id
and cust_order.order_id = order_line.order_id
and order_line.inv_id = inventory.inv_id
and inventory.item_id = item.item_id



ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-28 : 18:47:01
select first, last, order_date, item_desc
from customer, cust_order, item, order_line, inventory
where customer.cust_id = cust_order.cust_id
and cust_order.order_id = order_line.order_id
and order_line.inv_id = inventory.inv_id
and inventory.item_id = item.item_id
WHERE customer.first + customer.last IN ('paulaharris', 'mitchedwards')

Go to Top of Page

ak56s
Starting Member

3 Posts

Posted - 2002-10-28 : 18:59:39
I tried that, but it didn't work, here is the error I got in Oracle.

SQL> @test
WHERE customer.first + customer.last IN ('PaulaHarris', 'MitchEdwards')
*
ERROR at line 7:
ORA-00933: SQL command not properly ended


Input truncated to 1 characters
SP2-0042: unknown command "'" - rest of line ignored.

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-10-28 : 20:43:04
Ahhh there is your first problem (other than crossposting). We are an SQL Server site. So SQL Server is assumed. You might be better off at an Oracle site

Damian
Go to Top of Page
   

- Advertisement -