Jump to content

QRY problem


wmguk

Recommended Posts

Hey,

 

This is my current qry:

 

$sql = "SELECT * FROM clients, contacts WHERE (contacts.a_accmgr = 'barry') AND (clients.company LIKE 'W%') AND clients.level != 'CLOSED' AND (clients.level LIKE '%' OR clients.active LIKE '%') ORDER BY clients.company ASC " ;

 

but what I get is in contacts, there are more than one contact for each company so it displays all the contacts within the companies too... I need to show only one row per company name

 

I tried:

 

GROUP BY contacts.client_id

 

but it shows one row.... is there a way to display one row for each contacts.client_id but still show all the other companies?

Link to comment
https://forums.phpfreaks.com/topic/152230-qry-problem/
Share on other sites

I need to show only one row per company name

With this you mean show a company only once right?

 

is there a way to display one row for each contacts.client_id

With this you mean each contact_id has to have its row? or did actually mean column?

 

You could use the group by to put all the contact_id's in one field. Do replace the * with the specific column names you wish to have

Link to comment
https://forums.phpfreaks.com/topic/152230-qry-problem/#findComment-799408
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.