Question: I am working on a table which has data like this-- Sorry for formatting as I am new here

```
ColA  Type    Name    Email 
-----------------------   
1     Type1  John     yyyy@m  
1     Type2  Emily    xxx@m  
2     Type2  Richard  ooo@m  
3     Type1  Rebecca  pppp@m  
3     Type2  Pumpkin   nnnn@m  

```

I want to have an output based on Type Column 

```
COL1 TYPE1Name TYPE1Email Type2Name Type2Email 
-------------------------   
1    John      yyyy@m      Emily    xxx@m   
2    NULL      NULL        Richard  ooo@m  
3    Rebecca   pppp@m      Pumpkin    nnnn@m    

```

I tried 2 CTE's with the pivots and joining them but did not get the results 
Any suggestions

Answer: 
If you use hasNext() on a scanner it will wait for an input until you stop the program. Also using equals() is a better way of comparing strings.

```
while(user_input.hasNext()){
                function = user_input.next();
                if (function.equals("s")){
                    System.out.print("Enter your number: ");
                    number = user_input.nextInt();
                    System.out.print(number * number);
                } else {
                    System.out.println("Unidentified Function!");
                }
            }

```
```
 Scanner s = new Scanner(System.in);
    String str = s.nextLine();
int a=s.nextInt();
int b=s.nextInt();
    if(str.equals("+"))
    c=a+b;
    else if(str.equals("-"))
    c=a-b;
    else if(str.equals("/"))
    c=a/b;
    // you can add operators as your use
    else
    System.out.println("Unidentified operator" );

```

I hope it helps!