473,396 Members | 1,843 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.

Generating a table with missing values in SQL

I have the following table:

+------+------+------+-----------+
|ID |GROUP |CODE |ANSWER |
+------+------+------+-----------+
|1 |1 |001 |01-01-2003 |
|2 |1 |002 |Yes |
|3 |1 |003 |NA |
|4 |1 |004 |297797 |
|5 |1 |005 |0 |
|6 |2 |002 |Yes |
|7 |2 |004 |297852 |
|8 |2 |005 |1 |
+------+------+------+-----------+

This means that code 001 and 003 of group 2 are missing. Result of the
query should be:

+-------+-----------+-----------+-----------+-----------+--------+
|GROUP |ANSWER1 |ANSWER2 |ANSWER3 |ANSWER4 |ANSWER5 |
+-------+-----------+-----------+-----------+-----------+--------+
|1 |01-01-2003 |Yes |NA |297797 |0 |
|2 |NULL |Yes |NULL |297852 |1 |
+-------+-----------+-----------+-----------+-----------+--------+

The missing values should be replaced by a NULL value in my resultset.
Is this possible? I don't have any clue how my query should look like,
can anyone help me and show me a solution? Thanks.
Jul 19 '05 #1
0 1532

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

Similar topics

4
by: Justin Lebar | last post by:
Sorry about the huge post, but I think this is the amount of information necessary for someone to help me with a good answer. I'm writing a statistical analysis program in ASP.net and MSSQL7 that...
4
by: The Blob | last post by:
Hi all, I need sone help on generating a SQL statement i had 3 tables now Customer >> Name >> Acct No >> Address
4
by: Mark | last post by:
BEGINNER QUESTION I have a table which has a compound primary key consisting of two columns. One of these columns is a foreign key which is generated in another table by an identity. I want...
9
by: YONETANI Tomokazu | last post by:
Hi. You can use the following SQL to construct rows with column names on the fly, rather than from an existing table like sysibm.sysdummy1: SELECT * FROM TABLE ( VALUES (0, 1, 2), (3, 4, 5), (6,...
6
by: HD | last post by:
Hello. For the following, I would appreciate if anyone could tell me: if it can be done, how it might done, and/or what search terms I could use to find the solution myself. I would like to...
7
by: mutemode | last post by:
Help again please, I need to insert rows into a table from another table. The tables are identical column wise except the table im inserting from does not have a primary key value. On insert I...
3
by: Patrick.O.Ige | last post by:
Hi guys, Is there any free stuff to generate DAL code out there? Thanks in advance
3
by: G. Miller | last post by:
Hey, I've got what seems like a simple question, but I've been wrestling around with it for way too long. I've got two fields in a table named and . I don't want the user to be able to enter a...
2
by: lenygold via DBMonster.com | last post by:
Hi Everebody: I have a table: CREATE TABLE CROSS_REFERENCE (ROW# INTEGER NOT NULL ,KEY_WORD CHAR(16) NOT NULL ,QUERY_DESCR VARCHAR(330) NOT NULL ,PRIMARY KEY (ROW#,KEY_WORD)); It is a...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.