shoppehaa.blogg.se

Join two table in sql with null values
Join two table in sql with null values












We use the variables to hold the value of Name and currentstatus from the previous row. I tested this via you can play with the query and test data here. SELECT = ab.Name, '', ab.Name) as = ab.Name AND = ab.currentstatus, '', ab.currentstatus) as := ab.Name as := ab.currentstatus as := + 1 as RowOrder The following query should do what you want: SET := '' That said, sometimes the SQL Server has more than enough capacity to handle the formatting, or doing it at the application end doesn't make sense for some reason. If you have more CPU power available at the application end than on the SQL Server, then you will be likely to get better performance if you can allow the application to handle the formatting requirements. I am new to sql and will be grateful for your advice and suggestionįirst, I should note that this is basically a formatting requirement: you don't want to repeat the values in the first two columns if they're the same as they were in the previous column. | Ahsan Naseem | Active | ACTIVE | ahsan.naseem | What I am trying to achieve is : +-+-+-+-+ | Ahsan Naseem | activated | decent.ahsan_cli | INACTIVE | | Ahsan Naseem | activated | decent.ahsan | INACTIVE |

join two table in sql with null values

| Ahsan Naseem | activated | ahsantestuserprofileupdate_cli | INACTIVE | | Ahsan Naseem | activated | ahsantestuserprofileupdate | ACTIVE | | Ahsan Naseem | activated | ahsantest2 | ACTIVE | | Ahsan Naseem | activated | ahsantest | INACTIVE | | Ahsan Naseem | activated | ahsan.naseem | ACTIVE | | Name | currentstatus | username | status | JOIN ( SELECT * from awsaccount where username like '%ahsan%' ) as asb

join two table in sql with null values

| NULL | NULL | INACTIVE | decent.ahsan_cli |įrom ( SELECT * from statustable where Name like '%ahsan%' ) as ab

join two table in sql with null values

| NULL | NULL | INACTIVE | decent.ahsan | | NULL | NULL | INACTIVE | ahsantestuserprofileupdate_cli | | NULL | NULL | ACTIVE | ahsantestuserprofileupdate | | Ahsan Naseem | activated | NULL | NULL | | NAME | currentstatus | status | username | SELECT NULL AS NAME, NULL AS currentstatus, username, status SELECT NAME, currentstatus, NULL AS username, NULL AS status So I have multiple tables which I have to merge when query but both join and union doesn't seems to achieve what my object is














Join two table in sql with null values