cfcProgrammer
Programmer
Hi,
I am new to sql query. Could someone please take a look at the below query and advise me why I am getting every record from the customer table when all I want is the customer id I have identified in the select statement. I need to have the fields identified in the main select as part of the results.
SELECT m.Id as 'Mobile ID',
m.SerialNum as 'Serial NO',
m.CustomerId as 'Mobile Customer ID',
c.Id as 'Customer ID',
c.ParentCustomerId as 'Parent ID',
c.ARAccountCode as 'Account Code',
c.ContactCompanyName as 'Contact Name'
FROM Mobile m, Customer c
where
m.CustomerId in(SELECT c.Id
FROM Customer c
where (c.Id = 22151 or c.ParentCustomerId = 22151)
and c.IsActive ='1')
and m.IsActive ='1'
Thanks
CfcProgrammer
cfcProgrammer
I am new to sql query. Could someone please take a look at the below query and advise me why I am getting every record from the customer table when all I want is the customer id I have identified in the select statement. I need to have the fields identified in the main select as part of the results.
SELECT m.Id as 'Mobile ID',
m.SerialNum as 'Serial NO',
m.CustomerId as 'Mobile Customer ID',
c.Id as 'Customer ID',
c.ParentCustomerId as 'Parent ID',
c.ARAccountCode as 'Account Code',
c.ContactCompanyName as 'Contact Name'
FROM Mobile m, Customer c
where
m.CustomerId in(SELECT c.Id
FROM Customer c
where (c.Id = 22151 or c.ParentCustomerId = 22151)
and c.IsActive ='1')
and m.IsActive ='1'
Thanks
CfcProgrammer
cfcProgrammer