1
Answer

Selecting same column in same table twice with different cri

Photo of crystal boy

crystal boy

11y
1.4k
1
Selecting same column in same table twice with different criteria in one query

I need to get  part_id as first column next six columns based on process_id=21 and next six columns based on process_id=42 and so on..it retrieves duplicate records.Please help

     SELECT   DISTINCT A.PART_ID,
                  A.resources,
                  A.SCRAP_PCT,
                  A.FPLT,
                  A.ATP_FAMILY,
                  A.rfgo_family,
                  A.gfgo_family,
                  B.Sec_Resources,
                  B.SEC_SCRAP_PCT,
                  B.SEC_FPLT,
                  B.SEC_atp_family,
                  B.SEC_rfgo_family,
                  B.SEC_gfgo_family
  FROM       (SELECT   DISTINCT a.PART_ID,
                                  f.name Resources,
                                  a.SCRAP_PCT,
                                  a.FPLT,
                                  e.NAME atp_family,
                                  c.NAME rfgo_family,
                                  d.NAME gfgo_family
                  FROM   s_ftl_line_mfg_process_map a,
                         s_ft_part_params b,
                         s_ft_rfgo_family c,
                         s_ft_gfgo_family d,
                         s_ft_atp_family e,
                         S_FTL_MACHINE_RESOURCE f
                 WHERE       f.name IS NOT NULL
                         AND a.part_id = b.part_id
                         AND b.rfgo_family_id = c.rfgo_family_id(+)
                         AND b.gfgo_family_id = d.gfgo_family_id(+)
                         AND b.atp_family_id = e.atp_family_id(+)
                        -- AND a.part_id = f.part_id(+)
                         AND A.PROCESS_ID = '21') A
            JOIN
               (SELECT   DISTINCT a.PART_ID,
                                  f.name Sec_Resources,
                                  a.SCRAP_PCT SEC_SCRAP_PCT,
                                  a.FPLT SEC_FPLT,
                                  e.NAME SEC_atp_family,
                                  c.NAME SEC_rfgo_family,
                                  d.NAME SEC_gfgo_family
                  FROM   s_ftl_line_mfg_process_map a,
                         s_ft_part_params b,
                         s_ft_rfgo_family c,
                         s_ft_gfgo_family d,
                         s_ft_atp_family e,
                         S_FTL_MACHINE_RESOURCE f
                 WHERE       f.name IS NOT NULL
                         AND a.part_id = b.part_id(+)
                         AND b.rfgo_family_id = c.rfgo_family_id(+)
                         AND b.gfgo_family_id = d.gfgo_family_id(+)
                         AND b.atp_family_id = e.atp_family_id(+)
                       --  AND a.part_id = f.part_id(+)
                         AND A.PROCESS_ID = '42') B
            ON A.part_id = B.part_id

Thanks,
Crystal

Answers (1)

0
Photo of Bryian Tan
NA 9.4k 887.4k 7y
You can use regular expression to get the file name. Here is an example: https://dotnetfiddle.net/DdzA3c
 
  1. using System;  
  2. using System.Text.RegularExpressions;  
  3.                       
  4. public class Program  
  5. {  
  6.     public static void Main()  
  7.     {  
  8.         string file = @"C:\Users\xyz\Desktop\FYP\Animal\abc.jpg";  
  9.         string pattern  = @"[ \w-]+?(?=\.)";  
  10.           
  11.         Regex regex = new Regex(pattern);  
  12.           
  13.         Match match = regex.Match(file);  
  14.           
  15.         Console.WriteLine(match.Value);  
  16.     }  


0
Photo of Nilesh Patil
NA 3.4k 7.1k 7y
Hi,
 
Refer This Code
 
private void timer1_Tick(object sender, EventArgs e)
{
counter++;
try // Get the tif file from C:\image\ folder
{
string path = @"C:\image\";
String filename = Directory.EnumerateFiles(path, "*.png").FirstOrDefault();
if (null != filename) {
// Load picture
pictureBox1.Load(filename);
// Show the file name
lblFile.Text = filename;
}
else {
//TODO: No *.png files are found
}
}
catch(IOException ex)
{
MessageBox.Show("No files or " + ex.Message);
}
}
 
0
Photo of Bryian Tan
NA 9.4k 887.4k 7y
and your question is?