I want to excute select cross query in mySQL.
I have the following table:
tblTest (Id Int, Memory Varchar(50), Content Text, User Varchar(2))
Primary key(Id, Memory)
I insert some records into this table:
Insert into tblTest Values(1, 'AAA', 'Content AAA1', 'usr1'),
Values(1, 'BBB', 'Content BBB1', 'usr1'),
Values(1, 'CCC', 'Content CCC1', 'usr1')
Insert into tblTest Values(2, 'AAA', 'Content AAA2', 'usr2'),
Values(2, 'BBB', 'Content BBB2', 'usr2'),
Values(2, 'CCC', 'Content CCC2', 'usr2')
.........................
I want excute cross query that result of that query is:
Fields: Id AAA BBB CCC User
Record 1: 1 Content AAA1 Content BBB1 Content CCC1 usr1
Record 2: 2 Content AAA2 Content BBB2 Content CCC2 usr2
......... ....................................................................................
How "Select query" do I can write?
Please help me!
Thanks!
Help me about Select in mySQL
Moderator: General Moderators
- dstefani
- Forum Contributor
- Posts: 140
- Joined: Sat Jan 11, 2003 9:34 am
- Location: Meridian Idaho, USA
Do you mean a 'CROSS JOIN', from your sample I don't think that's what you mean. 'Cross Query' eh? I'm only seeing one table here.
If I understand your post, you just want to execute a SELECT query.
But, if you don't know how to do that, then what will you do once you execute it?
I would go here:
http://www.php.net/manual/en/function.mysql-query.php
Download the windows help version of the manual.
You'll love it!
- D
If I understand your post, you just want to execute a SELECT query.
But, if you don't know how to do that, then what will you do once you execute it?
I would go here:
http://www.php.net/manual/en/function.mysql-query.php
Download the windows help version of the manual.
You'll love it!
- D
I'm sory because my questions' not clearly!
I want to convert datas in rows to field column.
Ex:
In MS Access 2000, I excute cross query:
test Table:

cross Query:

result of cross Query:

SQL String of cross query:
So that, i would like to write SQL in mySQL, please help me!
I want to convert datas in rows to field column.
Ex:
In MS Access 2000, I excute cross query:
test Table:

cross Query:

result of cross Query:

SQL String of cross query:
Code: Select all
TRANSFORM Max(tblTest.Content) AS MaxOfContent
SELECT tblTest.Id, tblTest.User
FROM tblTest
GROUP BY tblTest.Id, tblTest.User
PIVOT tblTest.Memory;