Question : MySQL IFNULL() selection

When i select data from two tables where a value exists in a columns in both tables i can just use the IFNULL method to select the value.

IFNULL(, m.user_id ) AS user_id     <--- This works

but when the value only exists in one of the tables i can't.

IFNULL( m.usergroup_id ) AS usergroup_id      <---- This doesn't work

usergroup_id <---- This works but NULL is returned
m.usergroup_id <---- This works but NULL is returned

How should i select the usergroup id when it only exists in one of the tables?
SELECT, u.username,, IFNULL(, m.user_id ) AS user_id
IFNULL( m.usergroup_id ) AS usergroup_id <--- This line doesn't work
FROM table1 AS u
LEFT JOIN table2 AS m ON = m.user_id

Answer : MySQL IFNULL() selection

The following is my solution:
1- Create a custom TreeItemRenderer as follows:
      import mx.controls.RadioButton;
      import mx.controls.RadioButtonGroup;
      import mx.controls.treeClasses.*;

      public class RadioButtonTreeItemRenderer extends TreeItemRenderer
            public var RadioBtn:RadioButton;
            public var RadioBtnGR:RadioButtonGroup
        public var itemXml:XML;

            public function RadioButtonTreeItemRenderer()
                  mouseEnabled = false;

            override public function set data(value:Object):void{
            if(value != null){
       = value;
                this.itemXml = XML(value);
                if([email protected] == true ){
                    this.RadioBtn.selected = true;
                    this.RadioBtn.selected = false;
        override protected function createChildren():void{
            RadioBtn = new RadioButton();
            RadioBtnGR = new  RadioButtonGroup();
  = RadioBtnGR;
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
                var tld:TreeListData = TreeListData(super.listData);

                    this.RadioBtn.visible = false;
                    this.RadioBtn.visible = true;
                    this.RadioBtn.x = super.label.x
                    super.label.x = this.RadioBtn.x + 17;
                    this.RadioBtn.y = super.label.y+8;


2- application code is :
<?xml version="1.0"?>
<mx:Application xmlns:mx="" backgroundColor="#FFFFFF">

      <mx:XML format="e4x" id="myData">

                  <item id="item1" label="List A">
                        <part id="part1" label="part1" checked = "true"  parentid="item1"/>
                        <part id="part2" label="part2" checked = "false" parentid="item1"/>


                  <item id="item2" label="List B">
                        <part id="part1" label="part1" checked = "false" parentid="item2"/>
                        <part id="part2" label="part2" checked = "false" parentid="item2"/>
                        <part id="part3" label="part3" checked = "true"  parentid="item2"/>
                        <part id="part4" label="part4" checked = "false" parentid="item2"/>
                        <part id="part5" label="part5" checked = "false" parentid="item2"/>

                  <item id="item3" label="Item c">
                        <part id="part1" label="part1" checked = "false" parentid="item3"/>
                        <part id="part2" label="part2" checked = "true" parentid="item3"/>


                  import mx.collections.ArrayCollection;
                  import mx.controls.Alert;

                  private function TreeClickHandler(event:Event):void
                        var selectedXmlList:XMLList;
                        var itemObject:Object = event.currentTarget.selectedItem;

                        if (!myTree.dataDescriptor.isBranch(itemObject)) {
                              selectedXmlList = myData.item.part.(@parentid == [email protected]);
                              processSelection(selectedXmlList,ite[email protected]d);


                  private function processSelection(list:XMLList,Objid:String):void {
                        var item:XML;
                        for each(item in list) {
                              if ([email protected]!=Objid)
                                    [email protected] = false;
                                    [email protected] = true;


      <mx:Panel width="75%" height="75%">


Random Solutions  
programming4us programming4us