|
something like that:
select a.personid1, a.personid2, p1.name, p2.name
from Activity a join person p1 on a.personid1 = p1.id join person p2 on a.personid2 = p2.id
(didn't test it though)
Furthermore, I suggest reading a book about SQL
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Activity Table: tblActivity
PersonId1
PersonId2
Person Table : tblPerson
PersonId
PersonName
Sql Stmt :
SELECT
A.PersonId1,
(Select PersonName from tblPerson P where P.PersonId = A.PersonId1)AS Person_Name1,
A.PersonId2,
(Select PersonName from tblPerson P where P.PersonId = A.PersonId2)AS Person_Name2
FROM tblActivity A
Regards
John
|
|
|
|
|
in the database i have a table for complains and to solve the complain 24hrs are given.if the time is expired i want to db to generate an E-mail and send it to manager .
i'm planning to do this by using a trigger. if it is possible to do how to impliment this other wise could you please suggest how to do it ,
|
|
|
|
|
Trigger's are probably used against a database operation like Insert, Update, Delete. Not when a job is failed.
Why not try with Sql Server Agent and the extended stored procedure xp_sendmail.
Sql server has the ability to send mail without being triggered from the application. you can set up a job through Sql Server agent that wakes up and check's at proper intervals whether any job is failed and if yes then send's email.
Regards
John
|
|
|
|
|
i have a dedicated table "Emails" with columns: "From","To","Subject","Text"
The table has trigger on insert that calls a xp_sendmail
Any time i need to send an email fron anywhere all i have to do is insert a record in that table!
|
|
|
|
|
Hi all,
I have problem to pass a value from one parameter to other parameters on my report.
On my report I have 3 parameters, year as integer, DateStart as datetime, DateEnd as datetime.
Is anyone know how to set the display value of the Datestart as (1/1/selectedyear) and DateEnd (12/31/selectyear) bases on the selection of the year and the calendar control will show next to the DateStart and DateEnd?
btw, I am using SSRS 2005 reporting services.
Thanks for your help.
Sue
|
|
|
|
|
Anybody know of a good way to do this? Basically, I want to take something like the following table:
12/12/2005 10998
12/12/2005 11000
And return something like this:
12/12/2005 10998,11000
I'd love to see an aggregate, though I'm sure nothing like the following exists:
Select
[Date]
,Concat(id, ',')
From
Table1
Group By
[Date]
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA www.defaultn.com
|
|
|
|
|
|
Awesome tip! Thanks a ton. I plugged it in and it works like a charm!
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA www.defaultn.com
|
|
|
|
|
I want to study database from a to z coz i havegot a project any book
SAS
|
|
|
|
|
So what do you expect from us? Read the book. If you have a specific problem then why don't you ask it? Good luck with learning
|
|
|
|
|
So what? Are you expecting us to write it for you from scratch? Try reading a book and learning or finding tutorials on Google. These forums are for specific questions like "I'm getting an error with this query, here is my code" not for people who are to lazy to do the research themselves.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Which database do you think that you will be using (MS-Access, SQL-Server, Oracle, etc) and what programming language will you be using for the front-end application?
|
|
|
|
|
sajid.salim.khan wrote: any book
Well, Harry Potter and the Chamber Of Secrets is pretty good but I won't spoil it for you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
sajid.salim.khan wrote: to study database from a to z
WOW I havent been able to do that in 3 years...
as a beginner, and to get aware of the basics of DBMS concepts try reading the jeffery Hoffman's book on Database Management Systems
Try searching it on google 4 urself to find the exact title.
|
|
|
|
|
Hi,
Is it possible to print a table's fields with the coloumn names and data types for each field? I normally take screenshots. It's for SQL Server 2000 and 2005.
Regards
ma se
|
|
|
|
|
Have you tried sp_help 'tablename' ?
Ben
|
|
|
|
|
The best way to document a table is to generate the script that creates the table - that way you can be certain you've captured all the parameters. Right-click the table, then select all tasks -> generate SQL script.
|
|
|
|
|
I create a new DataBase in the user pc i want to script some assistant information in a certain tables in the created DataBase.
merwa
|
|
|
|
|
merwa wrote: I create a new DataBase in the user pc i want to script some assistant information in a certain tables in the created DataBase.
Do you have a question? or do you just want to tell us what you are planning to do? If it is the latter, perhap http://www.twitter.com[^] may be a better site to announce this.
|
|
|
|
|
check out Vyas' site for a stored proc. You pass in a table name it scripts the data as inserts , really neat.
W
http://vyaskn.tripod.com/code.htm#inserts
|
|
|
|
|
Hi,
I have the following tables:
Product
ProductInCategory
Category
When I supply the product ID then I need to know all the category names in which it belongs. ProductInCategory contains only product IDs and category IDs. Here is my "link statement:
SELECT *
FROM Product
INNER JOIN ProductInCategory as "pc_Product"
ON Product.ID = pc_Product.ProductID
INNER JOIN ProductInCategory as "pc_Category"
ON pc_Category.CategoryID = Category.ID
WHERE Product.ID = '9780817637606';
My error is:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Category.id" could not be bound.
Please can some one help me.
Regards
ma se
|
|
|
|
|
You didn't include Category table in your select query
here is my quick analyze
SELECT Product.*,ProductInCategory.*,Category.*<br />
FROM Product,ProductInCategory,Category<br />
where Product.ID = ProductInCategory.[ProductID]<br />
and ProductInCategory.CategoryID = Category.[ID]<br />
and Product.[ID] = '9780817637606';
I Love SQL
|
|
|
|
|
Thanks.
But I would like to use JOINS. Can you please help me now?
|
|
|
|
|
Just open Enterprise Manager of SQL2000 then create new View, copy code and paste in area of view then SQL Manager generates joins .
I Love SQL
|
|
|
|