|
|
|
|
|
|
| Author |
Message |
Frank Piron *nix forums beginner
Joined: 27 Apr 2005
Posts: 7
|
Posted: Thu Feb 10, 2005 10:54 am Post subject:
Re: sql with multiple aliases, multirow record
|
|
|
Hi,
Am 10 Feb 2005 02:15:03 -0800 schrieb Mariusz <mr.m@biaman.pl>:
<snip>
</snip>
| Quote: | When I run:
select a.ID, concat(a.text, concat(b.text, c.text)) from T1 a, T1 b, T1 c
where a.code='123' and b.code='124' and c.code='322';
I get:
1 aa bb dd
2 ff gg dd
So, c.text is appened from previous row. How to clear c.text before next
pass ?
It should return:
1 aa bb dd
2 ff gg
I other words, how to select one row data from multi-row record ?
Regards,
mariusz
|
If i got you right, you have to ensure that your data sources
share a common id:
select a.ID, concat(a.text, concat(b.text, c.text)) from T1 a, T1 b, T1 c
where a.code='123' and b.code='124' and c.code='322' and
a.id=b.id=c.id;
regards
--
Frank Piron,
defrankatkonaddot
(leftrotate two) |
|
| Back to top |
|
 |
Mariusz *nix forums beginner
Joined: 01 Mar 2005
Posts: 8
|
Posted: Thu Feb 10, 2005 9:15 am Post subject:
sql with multiple aliases, multirow record
|
|
|
Hello,
I have table T1 with multiple row record:
ID code text
1 123 aa \
1 124 bb \
1 134 cc / one logical record
1 322 dd /
2 123 ff
2 124 gg
2 344 hh
3 ...........
3 ............
........
...........
When I run:
select a.ID, concat(a.text, concat(b.text, c.text)) from T1 a, T1 b, T1 c
where a.code='123' and b.code='124' and c.code='322';
I get:
1 aa bb dd
2 ff gg dd
So, c.text is appened from previous row. How to clear c.text before next pass ?
It should return:
1 aa bb dd
2 ff gg
I other words, how to select one row data from multi-row record ?
Regards,
mariusz |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Wed Jan 07, 2009 6:34 pm | All times are GMT
|
|
Business Credit Cards | Read Manga Online | Mortgages | Final Fantasy | Read Free Manga Online
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|