Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need help

Author  Topic 

totte1015
Starting Member

2 Posts

Posted - 2011-11-21 : 04:25:32
I need help with WampServer in mySQL:

I have theese tables:

mysql> select * from bilar;
+--------+------------+-----------+-----------+--------+-------+
| reg | marke | modell | arsmodell | pris | agare |
+--------+------------+-----------+-----------+--------+-------+
| ABC123 | Saab | 9-5 | 2003 | 130000 | 1 |
| ABC456 | Volkswagen | Polo | 2003 | 75000 | 1 |
| DEF123 | Volvo | S80 | 2002 | 140000 | 2 |
| DEF456 | Toyota | Carina II | 1998 | 30000 | 2 |
| GHI123 | Mazda | 626 | 2001 | 80000 | 3 |
| JKL123 | Audi | A8 | 2001 | 150000 | 5 |
| MNO123 | BMW | 323 | 1998 | 60000 | 5 |
| PQR123 | Ford | Mondeo | 2001 | 90000 | 4 |
| STU123 | Volvo | 740 | 1987 | 35000 | 5 |
| VYX123 | Volkswagen | Golf | 1988 | 40000 | 5 |
+--------+------------+-----------+-----------+--------+-------+
10 rows in set (0.06 sec)

and this one:

mysql> select * from personer;
+----+-----------+-------+--------------+
| id | fnamn | enamn | fodelsedatum |
+----+-----------+-------+--------------+
| 1 | Kalle | Anka | 1934-07-09 |
| 2 | Kajsa | Anka | 1937-09-01 |
| 3 | Knatte | Anka | 1937-10-17 |
| 4 | Tjatte | Anka | 1937-10-17 |
| 5 | Fnatte | Anka | 1937-10-17 |
| 6 | Knase | Anka | 1964-08-02 |
| 7 | Alexander | Lukas | 1948-01-01 |
+----+-----------+-------+--------------+
7 rows in set (0.04 sec)

i want to do a command so it looks like this:

+------------------------------------+
| Biltabell |
+------------------------------------+
| Kalle Anka har en Saab 9-5 |
| Kajsa Anka har en Volvo S80 |
| Knatte Anka har en Mazda 626 |
| Tjatte Anka har en Audi A8 |
| Tjatte Anka har en BMW 323 |
| Fnatte Anka har en Ford Mondeo |
| Tjatte Anka har en Volvo 740 |
| Tjatte Anka har en Volkswagen Golf |
| Kalle Anka har en Volkswagen Polo |
| Kajsa Anka har en Toyota Carina II |
+------------------------------------+
10 rows in set (0.00 sec)

What is the command? :S

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-11-21 : 04:40:18
You should ask in a MySQL Forum because this forum is for MS SQL Server only.
The given solution in MS SQL Server T-SQL would not work for you because there is a big difference in concatenating columns.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-21 : 04:42:15
Can you tell how two tables are related? ie on what column?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

totte1015
Starting Member

2 Posts

Posted - 2011-11-21 : 04:45:24
They are 2 different tables, i have to do inner join to connect them i think...

I dont know much about this :S
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-21 : 04:52:05
quote:
Originally posted by totte1015

They are 2 different tables, i have to do inner join to connect them i think...

I dont know much about this :S


unless you know how they're related, we wont be able to provide much help

Also as Fred pointed out this is MS SQL Server forum. why not try your luck in MySQL forum?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -