all groups > sql server new users > january 2007 >
You're in the

sql server new users

group:

Query Help


Query Help Hulicat
1/30/2007 4:15:03 PM
sql server new users:
I am trying to join these two select statements into a single result
that would look like the following:

Ticket Number, Issue, Email

meeting this criteria from table "job_ticket" WHERE
job_ticket.location_id = '5' and status_type_id like '[1-2]'

Both select statements work fine by themselves....I just need to add
the email address tied to the client_id in the "clients" table to the
1st query listed.





SELECT job_ticket.job_ticket_id 'Ticket Number', job_ticket.subject
'Open Issues'
FROM job_ticket
WHERE job_ticket.location_id = '5' and status_type_id like '[1-2]'

Select email from client where client_id ='5'



Data from Table "Job_ticket"
ticket_id
subject
client_id
location_id
Status_type_id


Data from table "Client"
client_id
email



I have tried various methods and read through "books online", however;
I am not making much progress.


What is the best way to do this?

Any information would be greatly appreciated.

Thanks,
H
Re: Query Help Steve
1/30/2007 5:22:25 PM
[quoted text, click to view]

SQL Server 2005 Books Online
FROM (Transact-SQL)

F. Using the SQL-92 INNER JOIN syntax
The following example returns all product names and sales order IDs.

USE AdventureWorks ;
GO
-- By default, SQL Server performs an INNER JOIN if only the JOIN
-- keyword is specified.
SELECT p.Name, sod.SalesOrderID
FROM Production.Product p
INNER JOIN Sales.SalesOrderDetail sod
ON p.ProductID = sod.ProductID
ORDER BY p.Name ;
AddThis Social Bookmark Button