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.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | svibukYak Posting Veteran
 
 
                                        62 Posts | 
                                            
                                            |  Posted - 2013-08-03 : 05:47:03 
 |  
                                            | i have a table with 5 fieldsfield1 ie STATUS  will have values as 'd' and 'i'if the field1 of table has both the values then only the data shld e displayedbut if the field1 has only value 'd' then no data shld be displayedi have tried select * from #temp1 where col1='d' and col1 ='i'but nothing gets displayedi have given here for table1but there  are 5 tables total and i need the result output with union allexampleselect * from #5_TEMPunion all select * from #4_TEMPunion allselect * from #3_TEMPif all this 3 tables has STATUS 'd' and 'a' then the union will be of all 3 tablesif 4_TEMP has data of only STATUS='d' then table 4_TEMP will not be included in the union the the union will be as select * from #5_TEMPunion allselect * from #3_TEMP |  |  
                                    | stepsonAged Yak Warrior
 
 
                                    545 Posts | 
                                        
                                          |  Posted - 2013-08-03 : 08:31:51 
 |  
                                          | how is your data store in field STATUS ?i ask because a WHERE clause , i guess, will solve your prob where col1='d' and col1 ='i'post some sample data pleaseCe-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb |  
                                          |  |  |  
                                |  |  |  |