Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: select from table

Posted on 2007-07-12 14:43:19 by patrick

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.

Report this message

#2: Re: select from table

Posted on 2007-07-15 01:50:49 by David Ayres

On Jul 12, 8:43 am, Patrick <g...@geen.nl> wrote:
> 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

Report this message

#3: Re: select from table

Posted on 2007-07-23 14:48:40 by Captain Paralytic

On 12 Jul, 13:43, Patrick <g...@geen.nl> wrote:
> 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`

Report this message