473,406 Members | 2,356 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,406 software developers and data experts.

SQL: Write 24 rows undependent of how many sows sql returns.

Hello i have a sql question, it looks like this.

Expand|Select|Wrap|Line Numbers
  1. sQuery = "SELECT COUNT(ID) as CNT, datepart(hh,TimeStamp) FROM CS WHERE ID=? GROUP BY datepart(hh,TimeStamp)"
  2.  
  3. ......
  4.  
  5. While oReader.Read()
  6.  
  7.   strXML = strXML & "<set name='" & oReader.GetInt32(1) & "' value='" & oReader.GetInt32(0) & "' />"
  8.  
  9. End While
  10.  
This does the job. But, i want to write out 24 of this
Expand|Select|Wrap|Line Numbers
  1. "<set name='00' value='0' />"
  2. "<set name='02' value='0' />"
  3. "<set name='03' value='0' />"
  4. "<set name='04' value='0' />"
  5.  
  6. and so on...
  7.  
as you can see i group by hh then you may know what im looking for, i want to whrite out all 24 hours and when the reader has a row with a value i want to whrite this:
Expand|Select|Wrap|Line Numbers
  1. "<set name='" & oReader.GetInt32(1) & "' value='" & oReader.GetInt32(0) & "' />"
  2.  

I hope you understand my question and my english, if you dont please tell me.

Regards
Phred
Feb 9 '08 #1
2 1216
ck9663
2,878 Expert 2GB
your query turns out right...writing it out 24x would depend with your APPS...

-- ck
Feb 9 '08 #2
oops, sorry. i think i posted this in the wrong category :/

it should be under .NET or ASP maybe ?

its a ASP.NET 1.x app.

/Phred
Feb 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
1
by: Amjad | last post by:
Hi, I have written a program that reads certain rows from a table in a local JET database file. I use SQL strings to select the rows that I want to read. Everything works fine on my development...
138
by: Ian Boyd | last post by:
i've been thrown into a pit with DB2 and have to start writing things such as tables, indexes, stored procedures, triggers, etc. The online reference is only so helpful. The two pdf manuals are...
3
by: baka | last post by:
Dear Sir/madam Here i am having some one sql which returns more rows than the required rows after comaparing tables simple sql statement will be lokk like SELECT t.empcd, s.daicd, s.chucd,...
6
by: Fuzzydave | last post by:
I am back developing futher our Python/CGI based web application run by a Postgres DB and as per usual I am having some issues. It Involves a lot of Legacy code. All the actual SQL Querys are...
0
by: Medhatithi | last post by:
Hi, I have been in several ways benefiited from this site. I would like to share some sql tuning techniques(simple, but effective) with you all. SQL Tuning Tips Oracle Tips Session #6 ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.