I have three tables
Table1
col1, col2
Table2
col1, col2
table3
col1, col2, col3
col2 of table2 is a foreign key refering tabl1(col1)
col2 of table3 is a foreign key refering table2(col1)
I want to get for each col1 in table1, how many distinct values of col3 are there in table3
I tryed...
you mean
select tbl1.*
from tbl1 inner join tbl2
on tbl1.col2 = tbl2.col1
inner join tbl3
on tbl1.col2 = tbl3.col1
where ((tbl3.col2 is not null) AND (tbl2.col2 is not null))
this code is not giving me the right recordset
col1 col2
1 1
2 1
3 2
4 3
the query...
Hi,
I have three table
say
tbl1
col1 col2
1 1
2 1
3 2
4 3
tbl2
col1 col2
1 aa
2 bb
tbl3
col1 col2
1 dd
2 ee
3 ff
col2 of tbl1 is a foreign key refering to col2 of both tbl2 and tbl3
I want to...
it is returnig more records
there ia a duplicate value on sve.sve_stu_id, sso.sso_stu_id, ses.SES_SVE_ID, eae.EAE_SES_ID
what should my could look like in ansi-standard join statement
I was trying to convert this query to ansi standard join statemet, but it is not giving the same record set waht did I miss
<html>
<head>
<title>query that should be converted</title>
</head>
<body>
SELECT eae.EAE_SES_ID
FROM PHOENIX.EXPEDITED_ADVERSE_EVENTS EAE
WHERE...
I have a query and, no matter how many indexes I have added I can't remove the clustered index scanning
what do you suggest
below is the show plan text
|--Filter(WHERE:(((((((([@p_In_EVT_LAST_CHANGED_USER_ID_Num]=NULL OR...
Thank you for ur swift response
Actually the query is like this.There is an incoming parameter @p_In_EAE_NUMBER_Vch
SELECT EAE_ID FROM EXPEDITED_ADVERSE_EVENTS
WHERE CAST(EAE_NUMBER AS VARCHAR(15)) LIKE ISNULL(@p_In_EAE_NUMBER_Vch, CAST(EAE_NUMBER AS VARCHAR(15)) )
any suggestion
I have this query
The table PHOENIX.EXPEDITED_ADVERSE_EVENTS has clustsed index defined on EAE_ID and nonclustsred index defined on EAE_NUMBER
SELECT EAE_ID FROM PHOENIX.EXPEDITED_ADVERSE_EVENTS
WHERE CAST(EAE_NUMBER AS VARCHAR(15)) LIKE ISNULL(NULL, CAST(EAE_NUMBER AS VARCHAR(15)) )
when I...
to make the que easy
I have a table over 14 columns
a clustsred index is defined on the PK.
I am wrting a query to select 10 of the xolumns from the table, which leads to a clustsred index scan( that makes my query very slow)
I want to optimize the query by adding some indexes.
do I have to add...
what is a substitute for covering index in sql server 2000
There are many columns which are causing clustsred index scan that degrades my query performance
here is part of the showplan in my query
|--Clustered Index Scan(OBJECT:([DaidsesDev4].[Phoenix].[EAE_DIAGNOSTICS].[EDI_ID_PK])...
---code
SELECT 'Study Agent' AS StudyProductType,
esp.ESP_PRODUCT_NAME AS StudyIntervention,
esp.ESP_RELATIONSHIP_TYPE AS RelationshipToPrimaryAE,
esp.ESP_EXPECTED_TYPE AS StudyProductExpectedness
FROM phoenix.EAE_STUDY_PRODUCTS esp INNER JOIN phoenix.EAE_STUDY_AGENTS esa
ON esa.ESA_ESP_ID...
I have created a nonclustsred index on a column of a table that is refered in on stataement of a inner join statement;
but it is still going clustsred index scan,
what is the reason behind this and how can I solve this
Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.