Is there any way to simplyfy this sql using case when or any other condition
Hi,
Please ca you advise me to simplyfy the given sql
SELECT
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN SIZE
END AS off_1st_size_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN make
END AS off_1st_make_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN pattern
END AS off_1st_pat_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth1
END AS off_1st_size_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth2
END AS off_1st_make_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth3
END AS off_1st_pat_out,
--1st near side outer
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN SIZE
END AS near_1st_size_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN make
END AS near_1st_make_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN pattern
END AS near_1st_pat_txt_out,
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN TreadDepth1
END AS near_1st_size_out,
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN TreadDepth2
END AS near_1st_make_out,
CASE
WHEN AxleNo=1 and AxleType = 'NEARSIDE OUTER'
THEN TreadDepth3
END AS near_1st_pat_out,
--2nd Offside Outer
CASE
WHEN AxleNo=2 and AxleType = 'OFFSIDE OUTER'
THEN SIZE
END AS off_2nd_size_txt_out,
CASE
WHEN AxleNo=2 and AxleType = 'OFFSIDE OUTER'
THEN make
END AS off_2nd_make_txt_out,
CASE
WHEN AxleNo=2 and AxleType = 'OFFSIDE OUTER'
THEN pattern
END AS off_2nd_pat_txt_out,
CASE
WHEN AxleNo=2 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth1
END AS off_2nd_size_out,
CASE
WHEN AxleNo=2 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth2
END AS off_2nd_make_out,
CASE
WHEN AxleNo=1 and AxleType = 'OFFSIDE OUTER'
THEN TreadDepth3
END AS off_2nd_pat_out
from my fleets
With Many Thanks
Pol
polachan
Hello,
the same result ( maybe with records in slightly different order ), you can obtain using this code snippet.
SELECT SIZE AS off_1st_size_txt_out,
make AS off_1st_make_txt_out,
pattern AS off_1st_pat_txt_out,
TreadDepth1 AS off_1st_size_out,
TreadDepth2 AS off_1st_make_out,
TreadDepth3 AS off_1st_pat_out,
NULL AS near_1st_size_txt_out,
NULL AS near_1st_make_txt_out,
NULL AS near_1st_pat_txt_out,
NULL AS near_1st_size_out,
NULL AS near_1st_make_out,
NULL AS near_1st_pat_out,
NULL AS off_2nd_size_txt_out,
NULL AS off_2nd_make_txt_out,
NULL AS off_2nd_pat_txt_out,
NULL AS off_2nd_size_out,
NULL AS off_2nd_make_out,
NULL AS off_2nd_pat_out
WHERE AxleNo=1 and AxleType = 'OFFSIDE OUTER'
from my fleets
UNION
SELECT NULL AS off_1st_size_txt_out,
NULL AS off_1st_make_txt_out,
NULL AS off_1st_pat_txt_out,
NULL AS off_1st_size_out,
NULL AS off_1st_make_out,
NULL AS off_1st_pat_out,
SIZE AS near_1st_size_txt_out,
make AS near_1st_make_txt_out,
pattern AS near_1st_pat_txt_out,
TreadDepth1 AS near_1st_size_out,
TreadDepth2 AS near_1st_make_out,
TreadDepth3 AS near_1st_pat_out,
NULL AS off_2nd_size_txt_out,
NULL AS off_2nd_make_txt_out,
NULL AS off_2nd_pat_txt_out,
NULL AS off_2nd_size_out,
NULL AS off_2nd_make_out,
NULL AS off_2nd_pat_out
WHERE AxleNo=1 and AxleType = 'NEARSIDE OUTER'
from my fleets
UNION
SELECT NULL AS off_1st_size_txt_out,
NULL AS off_1st_make_txt_out,
NULL AS off_1st_pat_txt_out,
NULL AS off_1st_size_out,
NULL AS off_1st_make_out,
NULL AS off_1st_pat_out,
NULL AS near_1st_size_txt_out,
NULL AS near_1st_make_txt_out,
NULL AS near_1st_pat_txt_out,
NULL AS near_1st_size_out,
NULL AS near_1st_make_out,
NULL AS near_1st_pat_out,
SIZE AS off_2nd_size_txt_out,
make AS off_2nd_make_txt_out,
pattern AS off_2nd_pat_txt_out,
TreadDepth1 AS off_2nd_size_out,
TreadDepth2 AS off_2nd_make_out,
TreadDepth3 AS off_2nd_pat_out
WHERE AxleNo=2 and AxleType = 'OFFSIDE OUTER'
from my fleets
If you find it easier to understand and to maintain. The result is made using "UNION" .
Šimon
Similar Messages
-
Just switched from safari on my imac. When using search menu in safari I had the option to "find on this page," which was an incredible help while doing research and looking for specific phrases/words. Is there any way to have this feature using firefox?
I think Safari has the same keyboard shortcut as Firefox "command+F" on a Mac or "Ctrl+F" on Windows.
Look in the lower left corner for the Find. There are more likely to be differences in Find Next and Find Previous in the keyboard shortcuts, but continuing at the Find bar at the bottom doesn't matter what browser you use. There is an "X" there to dismiss the Find bar. In Windows the "Esc" key will dismiss the bar if you are within the find text entry area.
Keyboard shortcuts:
* [https://support.mozilla.com/en-US/kb/Keyboard%20shortcuts?s=keyboard&r=0&as=s Keyboard shortcuts | How to | Firefox Help], from Mozilla very limited number of shortcuts but will show correctly for your system
* [http://dmcritchie.mvps.org/firefox/keyboard.htm Firefox and other Browser Keyboard Shortcuts (Comparison Table)], more comprehensive but is oriented to Windows users with some guidelines for Mac and Linux users.
<br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small> -
is their any way to stop an iphone 4s from using data when i hit the 2gb limit on verizon wireless this way i dont have to pay the fee for extra data
thank youDon't know of any way for it to happen automatically, but you can still use the phone and send/receive sms with cellular data turned off.
-
Someone has stolen my ipod. I do not have it with me, but is there another way to find the cerial number or another piece of information i could turn into the police? is there anyway of getting it back, Becuase i hav a good idea of who stole it, and i have some prove, but its just witness prove, no real prove.
- If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up.
- You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
- If not shown, then you will have to use the old fashioned way, like if you lost a wallet or purse.
- Change the passwords for all accounts used on the iPod and report to school and police
- There is no way to prevent someone from restoring the iPod (it erases it) using it unless you had iOS 7 on the device. With iOS 7, one has to enter the Apple ID and password to restore the device.
- Apple will do nothing without a court order
Reporting a lost or stolen Apple product
- iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number -
Is there any way to power this device using a 12V dc power source without using an inverter?
I would like to know if there is a way to power the Time Capsule from a 12V dc power source without having to use an inverter?
Oh man you are talking my language.
Sure it is easy.. but you need to open the TC and replace the power supply..
In fact that is my recommended repair method.
https://sites.google.com/site/lapastenague/a-deconstruction-of-routers-and-modem s/apple-time-capsule-repair/repair-type3
You will see the construction details there.. but there are even simpler modules now.
And a link on that page to actual kits.
Note carefully if you use 12v it has to be regulated 12v so you are supplying the hard disk directly. Otherwise you are better feeding the TC a higher voltage.. 14-19v eg a car battery or SLA setup.. do not connect that directly to the TC hard drive.. it could blow the hard disk. They are 12v usually with 10% tolerance.
There is a kit for higher voltage input to create the 12v.. using buck boost supply module is also possible but much less efficient. -
Is there a way of doing this without using an inner class
hi, i have developed a tree applet but it takes ages to load on my machine. I was wondering if i could get rid of the inner class that is created when "valuechanged" is called (line 28). I am posting my whole code, i hope someone can help. Cheers Rups
[email protected]
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.TreeSelectionListener;
import javax.swing.event.TreeSelectionEvent;
import java.net.*;
import java.applet.AppletContext;
import java.util.Enumeration;
public class SimpleTree extends JApplet {
JTree tree = new JTree();
public void init() {
new SimpleTree();
public SimpleTree() {
// WindowUtilities.setNativeLookAndFeel();
Container content = getContentPane();
Object[] hierarchy =
{ "Some Useful Web Links ",
new Object[] { "Microsft","http://www.microsfot.com"},
new Object[]{"Yahoo", "http://www.yahoo.com"}
DefaultMutableTreeNode root = processHierarchy(hierarchy);
final JTree tree = new JTree(root);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)
tree.getLastSelectedPathComponent();
String hoopla = tree.getLastSelectedPathComponent().toString();
if (node == null) return;
if (node.isLeaf()) {
try {
getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
"viewer1");
}catch(Exception f) {
System.out.println("" + f);
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setVisible(true);
public DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
DefaultMutableTreeNode node =
new DefaultMutableTreeNode(hierarchy[0]);
DefaultMutableTreeNode child;
for(int i=1; i<hierarchy.length; i++) {
Object nodeSpecifier = hierarchy;
if (nodeSpecifier instanceof Object[]) // Ie node with children
child = processHierarchy((Object[])nodeSpecifier);
else
child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
node.add(child);
return(node);
public static void main(String [] args) {
JFrame f = new JFrame("") ;
Container contentPane = f.getContentPane();
contentPane.setLayout(new FlowLayout());
SimpleTree ta = new SimpleTree() ;
ta.init() ;
f.addWindowListener(new ExitListener());
f.setSize(250,500);
contentPane.add(ta,BorderLayout.CENTER);
f.setVisible(true) ;import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.TreeSelectionListener;
import javax.swing.event.TreeSelectionEvent;
import java.net.*;
import java.applet.AppletContext;
import java.util.Enumeration;
public class SimpleTree extends JApplet implements TreeSelectionListener {
JTree tree = new JTree();
public void init() {
new SimpleTree();
public SimpleTree() {
// WindowUtilities.setNativeLookAndFeel();
Container content = getContentPane();
Object[] hierarchy =
{ "Some Useful Web Links ",
new Object[] { "Microsft","http://www.microsfot.com"},
new Object[]{"Yahoo", "http://www.yahoo.com"}
DefaultMutableTreeNode root = processHierarchy(hierarchy);
final JTree tree = new JTree(root);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener( this );
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)
tree.getLastSelectedPathComponent();
String hoopla = tree.getLastSelectedPathComponent().toString();
if (node == null) return;
if (node.isLeaf()) {
try {
getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
"viewer1");
}catch(Exception f) {
System.out.println("" + f);
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setVisible(true);
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)
tree.getLastSelectedPathComponent();
String hoopla = tree.getLastSelectedPathComponent().toString();
if (node == null) return;
if (node.isLeaf()) {
try {
getAppletContext().showDocument(new URL("file://c:/webstuff/"+hoopla),
"viewer1");
}catch(Exception f) {
System.out.println("" + f);
public DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
DefaultMutableTreeNode node =
new DefaultMutableTreeNode(hierarchy[0]);
DefaultMutableTreeNode child;
for(int i=1; i<hierarchy.length; i++) {
Object nodeSpecifier = hierarchy[ i ];
if (nodeSpecifier instanceof Object[]) // Ie node with children
child = processHierarchy((Object[])nodeSpecifier);
else
child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
node.add(child);
return(node);
public static void main(String [] args) {
JFrame f = new JFrame("") ;
Container contentPane = f.getContentPane();
contentPane.setLayout(new FlowLayout());
SimpleTree ta = new SimpleTree() ;
ta.init() ;
// f.addWindowListener(new ExitListener());
f.setSize(250,500);
contentPane.add(ta,BorderLayout.CENTER);
f.setVisible(true) ;
} -
my pictures are not showing up on my iphone 4s and i do not have icloud set up is there any way ro fix this?
Pictures from where?
-
When I type anything in Firefox like an e-mail, spaces do not register immediately when I hit the spacebar, and it slows down my typing tremendously. I just installed Firefox today, and I had never had this problem before. I tested it in both my word processing program and in Internet Explorer, and there was no delay in either program, so I know it has to be a glitch with the FF program. Is there a way to fix this?
Also, sometimes when I would tap the mousepad to click a link, the screen would just scroll/jump to the bottom of that page instead of going to the next page. It did this on every attempt to click the link (I was reading a message in e-mail and was trying to go to my inbox, but it wouldn't let me).Okay, I found the solution. I simply restarted my computer, and the problem has gone away...so far.
-
Is there any way to backup Azure SQL regularly by scheduled job ?
Is there any way to backup Azure SQL regularly by scheduled job ?
there's really no equivalent of a SQL Server-like type of backup that you schedule using SQLAgent, however you can have scheduled exports, see this
link:
Note that Azure SQL Databases also has built-in backups for self-service restores, see this
link -
When I attempt to open a PDF file I saved from a website using Safari, I get the message "There was an error opening this document. The file is damaged and could not be repaired." When I save the same PDF file using FireFox it opens up immediately. Is there any way to correct this problem with Safari?
Back up all data.
Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
When I try to print a drawing imported from my ipad iphoto crops it. Is there any way to stop this?
Usual cause: printing at the wrong aspect ratio for the image - trying to print 5 x 3 in the shape of a 6 x 4 for instance.
Regards
TD -
I'm trying to add a playlist manually to my iPhone 4. It won't let me because it's trying to delete all of the music currently on my iPhone. Is there any way to prevent this from happening in order to start manually updating it?
Are you leaving the box unchecked to Manually manage music & videos? You don't need to to add anything to the iPhone.
Simply drag the playlist to the iPhone to manually add it. -
When I listen to music on my iPhone and pause it, if I come back to it later, the playlist has started over. I have a 4S running on iOS 7.0.4. Is there any way to keep this from happening so that my playlist will start off where I last was?
Dear Jody..jone5
Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
Goodluck
Atousa -
I bought my iphone 5s a week before and now its volume "up" button is not working when pressed.Does anybody know what to do to make it work?I have a one year warranty.Should i give it to apple retail shop or is there any way to solve this problem?
IF it is a manufacturing defect and you bought the device from Apple or an authorized Apple retailer, then take it into Apple.
-
I made a dumb decision to 'Erase Free Space' on my drive. I now have no free space, I realize because it wrote 0's over all my free space. Is there a way to undo this??? Help please I can't save any documents now! Thanks in advance all, it is truly appreciated. how can find the hidden temporary files using the terminal what do i type in?
It's more likely a failed Erase Free Space, which creates a huge temporary file; that's why it looks like you have no more available drive space. You can recover from this. See these links
https://discussions.apple.com/message/10938738#10938738
http://www.macgeekery.com/tips/quickie/recovering_from_a_failed_secure_erase_fre e_space
Post back if you need any help with this.
Maybe you are looking for
-
After downloading iOS7 on my iPhone 4S, I can not open the iTunes app. When I click on the app, the "page" pops up but then quickly crashes.
-
Why is all my icloud account linked with more than one apple id?
why is my iphone 5 merged with more than one account?
-
Unable to make Postal code as required field in Vendor master creation
Hi, We have a requirement of making Postal code (POST_CODE1) field under street address of new vendor master creation/change as a required field. In the configuration settings of vendor account group (OBD3), SAP provided Postal code City combined as
-
Hi experts, image the folowing situation: You have to replicate a contract from SRM to backends passing through XI. Can you please provide me a list of standard fields contained in SRM contract replicable to SAP backends without too many mapping pro
-
Can't start 1.5.5 on WinXP64
I am running WinXP64-bit SP2, and reloaded 11.0.6 after a major disk crash. Following the install, I replaced the default instance of SQL_Developer with freshly released 1.5.5 after deleting all the old SQL-Developer files, and copying in the new one