473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

select from table

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.
Jul 12 '07 #1
2 2324
On Jul 12, 8:43 am, Patrick <g...@geen.nlwrote:
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

Jul 14 '07 #2
On 12 Jul, 13:43, Patrick <g...@geen.nlwrote:
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`

Jul 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian T | last post by:
Hi, I've got what I think (probably incorrectly) should be a simple SELECT : Two colums with data like col1 col2 1 50 1 51 2 50
5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
4
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
5
by: Lennart | last post by:
I really like the construction: select * from new table (update ....) X but I noticed that it cant be used as: insert into T select * from new table (update ....) X because of:
6
by: dhek | last post by:
Hi, I have a very simple issue: for simplicity lets say I have 2 tables, A and B. - Table A contains 5 fields. Amongst these there is a 'id'-field which is but a reference to table B. - Table...
1
by: RichardR | last post by:
I have a webpage which has a table that contains a column with several drop down boxes (<SELECT>). The contents of the drop down boxes are dynamically populated so I have no idea what the actually...
10
by: removeps-groups | last post by:
How to display table and select next to each other? <html> <body> <table border=1 style="display:inline-table"> <tr><td>Hello1</td></tr> <tr><td>Hello2</td></tr> <tr><td>Hello3</td></tr>...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.