Unix Technical Forum

RE: Auto Fill blank Rows

This is a discussion on RE: Auto Fill blank Rows within the MySQL General forum forums, part of the MySQL category; --> Yup! That's the kind of thing I was looking for - I just had a complete blank moment Thanks!!! ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-17-2008, 06:13 AM
roger.maynard
 
Posts: n/a
Default RE: Auto Fill blank Rows

Yup! That's the kind of thing I was looking for - I just had a complete
blank moment

Thanks!!!

________________________________

From: Phil [mailto:freedc.bok@gmail.com]
Sent: 12 March 2008 17:05
To: roger.maynard
Cc: mysql@lists.mysql.com
Subject: Re: Auto Fill blank Rows


you could do something like

select dummy.row_id,real.reference from dummy left join real on
real.row_id=dummy.row_id;

would give NULL on the 'missing' rows,


On Wed, Mar 12, 2008 at 12:50 PM, roger.maynard
<roger.maynard@crayford.ltd.uk> wrote:


Anyone got any bright ideas of how to solve this one?

I have documents which can contain up to 15 rows of information.
Each row as it is added to the document reference can have any
ROW_ID
from 1 to 15 when it is added.

I want to be able to "Auto Fill" the blank rows on a SELECT.

eg

data in table is

ROW_ID | Reference
===================================
1 | Reference Line 1
3 | Reference Line 3
9 | Reference Line 9
11 | Reference Line 11
15 | Reference Line 15

RESULT REQUIRED is

ROW_ID | Reference
===================================
1 | Reference Line 1
2 |
3 | Reference Line 3
4 |
5 |
6 |
7 |
8 |
9 | Reference Line 9
10 |
11 | Reference Line 11
12 |
13 |
14 |
15 | Reference Line 15

I've been playing about with joins on a "dummy" table containing
just
rows 1 to 15, but am stuck in my thinking at the moment.

Any help gratefully received

Roger





--
Help build our city at http://free-dc.myminicity.com !

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:10 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com