on 11-22-2012 7:47 AM
Hi
I have written this query
SELECT a.Code, a.Name , b.U_Amount as Amount FROM [@TEMP]a left JOIN [@TEMP1]b ON a.Code = b.U_Al_Code left join ohem c on c.empid = 1
There are 4 records in Table 1 & 2 records in Table 2 of ID 1 . I want all the 4 records to be displayed and value in Amount in only 2 records as there are only 2 records with amount value of ID 1.
Above query is showing all 4 records from Table 1 and Amount Value also in 4 records but there are only 2 records in second table.
Thanks
Hi,
Use where condition in above query.
For example
Where T1.table ID 1 = T2 table ID1
Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
SELECT T0.[empID], T0.[firstName], T0.[lastName], T0.[sex], T0.[jobTitle], T0.[type], T0.[dept], T0.[branch], T0.[workCountr], T0.[manager], T0.[mobile], T0.[homeTel], T0.[startDate], T0.[homeCountr], T0.[homeState], T0.[brthCountr], T0.[martStatus], T0.[citizenshp], T0.[passportNo], T0.[passportEx]
FROM OHEM T0
WHERE T0.[Active] = 'y'
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
SELECT T0.[empID], T0.[firstName], T0.[lastName], T0.[sex], T0.[jobTitle], T0.[type], T0.[dept], T0.[branch], T0.[workCountr], T0.[manager], T0.[mobile], T0.[homeTel], T0.[startDate], T0.[homeCountr], T0.[homeState], T0.[brthCountr], T0.[martStatus], T0.[citizenshp], T0.[passportNo], T0.[passportEx]
FROM OHEM T0
WHERE T0.[Active] = 'y' and T0.[empID] = [%0]
Thanks & Regards,
Nagarajan
hello sunny,
As much i understand your problem, try this u may get desire output.
SELECT a.Code, a.Name , b.U_Amount as Amount FROM [@TEMP]a INNER JOIN [@TEMP1]b ON a.Code = b.U_Al_Code left join ohem c on c.empid = 1
thanks
vikas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.