Click here to Skip to main content
15,887,676 members
Home / Discussions / Database
   

Database

 
GeneralRe: 1 recursive field in a Query Pin
Mycroft Holmes14-Oct-10 11:12
professionalMycroft Holmes14-Oct-10 11:12 
GeneralRe: 1 recursive field in a Query [modified] Pin
Herman<T>.Instance17-Oct-10 22:21
Herman<T>.Instance17-Oct-10 22:21 
QuestionSubquery select case Pin
C#Coudou13-Oct-10 15:11
C#Coudou13-Oct-10 15:11 
AnswerRe: Subquery select case Pin
Karthik. A13-Oct-10 15:44
Karthik. A13-Oct-10 15:44 
GeneralRe: Subquery select case [modified] Pin
Alegria_Lee13-Oct-10 16:25
Alegria_Lee13-Oct-10 16:25 
GeneralRe: Subquery select case Pin
Karthik. A13-Oct-10 16:29
Karthik. A13-Oct-10 16:29 
GeneralRe: Subquery select case Pin
Alegria_Lee13-Oct-10 16:31
Alegria_Lee13-Oct-10 16:31 
GeneralRe: Subquery select case Pin
C#Coudou13-Oct-10 16:50
C#Coudou13-Oct-10 16:50 
@Karthik. A

thank you for your suggestion. yes. Alegria_Lee is correct MYFLG is not a column it is an alias from my case statement. sorry for my explanation not in details.

anyway. this is the actual query.

SELECT CASE WHEN SMPTABLE.RPFLG = 1 AND SMPTABLE.NDFLG= 0 THEN 
1 ELSE 0 END AS MYFLG
FROM  [TBMASTER] ,SMPTABLE,ANLTABLE,WKTABLE
WHERE (SMPTABLE.CERTCODE BETWEEN 1 AND 5 OR
SMPTABLE.CERTCODE BETWEEN 11 AND 15 or
SMPTABLE.CERTCODE = 17) AND
(SMPTABLE.DDATE IS NOT NULL) AND
(SMPTABLE.CERTNNO = 0 OR
SMPTABLE.CERTNNO IS NULL) AND ((SMPTABLE.DIVCODE = 1) OR
(SMPTABLE.DIVCODE = 5))
AND (ANLTABLE.ROWNO = 1) AND (ANLTABLE.KMKCD <> 1998)
AND [TBMASTER].SAMPLECD = SMPTABLE.SAMPLECD
AND ANLTABLE.SHINO=SMPTABLE.SHINO
AND  SMPTABLE.ORDNO = ANLTABLE.ORDNO
AND WKTABLE.ORDNO =SMPTABLE.ORDNO
AND ((WKTABLE.SECT=31) OR (WKTABLE.SECT =51))
AND ([ANLTABLE].ENVFLG = 0)


the result of MYFLG temporary columns are

MYFLG
0
0
0
0
1
1
0
1
0

; then i want to query again the result for those MYFLG = 0.
that is what my approach is subquery.
SELECT (SELECT).

:: i will try the NOT IN statement given by Alegria_Lee.
C# コードMicrosoft End User
2000-2008




「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」


GeneralRe: Subquery select case Pin
Blue_Boy13-Oct-10 21:01
Blue_Boy13-Oct-10 21:01 
GeneralRe: Subquery select case Pin
C#Coudou13-Oct-10 21:37
C#Coudou13-Oct-10 21:37 
GeneralRe: Subquery select case Pin
Blue_Boy13-Oct-10 21:43
Blue_Boy13-Oct-10 21:43 
QuestionPlease help me with my research problem [modified] Pin
bleedingfingers13-Oct-10 9:37
bleedingfingers13-Oct-10 9:37 
AnswerRe: Please help me with my research problem Pin
David Mujica13-Oct-10 10:44
David Mujica13-Oct-10 10:44 
GeneralRe: Please help me with my research problem Pin
bleedingfingers13-Oct-10 10:55
bleedingfingers13-Oct-10 10:55 
QuestionCouple general questions on sql server 2005+ transactional replication (in continuous mode specifically) Pin
Jon_Boy13-Oct-10 8:58
Jon_Boy13-Oct-10 8:58 
AnswerRe: Couple general questions on sql server 2005+ transactional replication (in continuous mode specifically) Pin
SimulationofSai14-Oct-10 17:05
SimulationofSai14-Oct-10 17:05 
QuestionHow pass dataset query as paramter in SSRS? Pin
andy_p 213-Oct-10 4:39
andy_p 213-Oct-10 4:39 
QuestionOracle development Pin
sinsoush113-Oct-10 2:26
sinsoush113-Oct-10 2:26 
AnswerRe: Oracle development Pin
David Mujica13-Oct-10 3:08
David Mujica13-Oct-10 3:08 
QuestionWhat am I missing here? - (Table Variable) [modified] Pin
Andy_L_J12-Oct-10 21:42
Andy_L_J12-Oct-10 21:42 
AnswerRe: What am I missing here? - (Table Variable) Pin
Blue_Boy12-Oct-10 22:11
Blue_Boy12-Oct-10 22:11 
GeneralRe: What am I missing here? - (Table Variable) Pin
Andy_L_J12-Oct-10 22:37
Andy_L_J12-Oct-10 22:37 
GeneralRe: What am I missing here? - (Table Variable) Pin
Blue_Boy12-Oct-10 22:41
Blue_Boy12-Oct-10 22:41 
GeneralRe: What am I missing here? - (Table Variable) Pin
Andy_L_J12-Oct-10 23:23
Andy_L_J12-Oct-10 23:23 
GeneralRe: What am I missing here? - (Table Variable) Pin
Mycroft Holmes13-Oct-10 0:58
professionalMycroft Holmes13-Oct-10 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.