Connecting Tech Pros Worldwide Help | Site Map

select from table

  #1  
Old July 12th, 2007, 01:45 PM
Patrick
Guest
 
Posts: n/a
Hi,

Can anyone show me how to do the following:

From a table I would like to retrieve the following:

company and websites.

When I do a select on on this table i'll get

company 1 - website 1
company 1 - website 2
company 1 - webiste 3

company 2 - website 1
company 2 - website 2

etc.
But what I would like is:

company 1 website 1
website 2
website 3

company 2 website 1
website 2

etc.

Now I use the following select statement:
$query="select company, domainname from DOMAIN, CLIENT_PERSONAL_DATA,
USER where DOMAIN.idclient = CLIENT_PERSONAL_DATA.id";

Regards, Patrick.


  #2  
Old July 15th, 2007, 12:55 AM
David Ayres
Guest
 
Posts: n/a

re: select from table


On Jul 12, 8:43 am, Patrick <g...@geen.nlwrote:
Quote:
Hi,
>
Can anyone show me how to do the following:
>
From a table I would like to retrieve the following:
>
company and websites.
>
When I do a select on on this table i'll get
>
company 1 - website 1
company 1 - website 2
company 1 - webiste 3
>
company 2 - website 1
company 2 - website 2
>
etc.
But what I would like is:
>
company 1 website 1
website 2
website 3
>
company 2 website 1
website 2
>
etc.
>
Now I use the following select statement:
$query="select company, domainname from DOMAIN, CLIENT_PERSONAL_DATA,
USER where DOMAIN.idclient = CLIENT_PERSONAL_DATA.id";
>
Regards, Patrick.
Patrick,

IMHO, that dataset wouldn't make much sense or be useful (even if it
were possible). What are you doing with this data?

Dave

  #3  
Old July 23rd, 2007, 01:55 PM
Captain Paralytic
Guest
 
Posts: n/a

re: select from table


On 12 Jul, 13:43, Patrick <g...@geen.nlwrote:
Quote:
Hi,
>
Can anyone show me how to do the following:
>
From a table I would like to retrieve the following:
>
company and websites.
>
When I do a select on on this table i'll get
>
company 1 - website 1
company 1 - website 2
company 1 - webiste 3
>
company 2 - website 1
company 2 - website 2
>
etc.
But what I would like is:
>
company 1 website 1
website 2
website 3
>
company 2 website 1
website 2
>
etc.
>
Now I use the following select statement:
$query="select company, domainname from DOMAIN, CLIENT_PERSONAL_DATA,
USER where DOMAIN.idclient = CLIENT_PERSONAL_DATA.id";
>
Regards, Patrick.
Try:
SET @head = '';
SELECT IF(@head=`company`,'',@head:=`company`) `company`,`website`
FROM `tab1`

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query data (SELECT * FROM table) from XML File =?Utf-8?B?RnJhbmsgVXJheQ==?= answers 9 June 27th, 2008 08:51 PM
select from table function where argument is a result set Eugene F answers 6 September 15th, 2006 04:15 PM
select * from table where column = @AllValues? saturnius@gmx.net answers 9 September 9th, 2005 10:25 PM
huh? select * from table where integer = '1a' .... John answers 8 July 20th, 2005 12:42 AM
huh? select * from table where integer = '1a' .... John answers 0 July 20th, 2005 12:41 AM