Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old June 27th, 2003, 03:21 PM
Next_Gate Next_Gate is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 45 Next_Gate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 36 sec
Reputation Power: 6
Inserting string in the query... for retriving data

I have this query...
PHP Code:
 SELECT idBloque ,nombre,
                    
'DESDE' = CASE
                        
WHEN desde >= 1200 THEN CONVERT(varchar desde 1200 ,103) + ' PM'
                        
ELSE CONVERT(varchar desde  103) + ' AM'
                    
END,
                    
'HASTA' = CASE
                        
WHEN hasta >= 1200 THEN CONVERT(varchar hasta 1200 ,103) + ' PM'
                        
ELSE CONVERT(varchar hasta  103) + ' AM'
                    
END


                FROM BLOQUE 


and the results are ok.. but in the results i need a separator included between the text.. this is the set of result this query gives me:

ID nombre DESDE HASTA
4 Bloque A 730 AM 900 AM
5 Bloque B 910 AM 1120 AM
9 Bloque C 1125 AM 1245 PM
10 Bloque D 130 PM 300 PM
11 Bloque E 310 PM 440 PM
12 Bloque F 530 PM 700 PM
13 Bloque G 740 PM 810 PM
14 Bloque H 820 PM 930 PM
15 Bloque I 930 PM 1100 PM


Till this point its ok.. but i need to insert a : in the DESDE and HASTA COLULMN... and get something like this:

ID nombre DESDE HASTA
4 Bloque A 7:30 AM 9:00 AM
5 Bloque B 9:10 AM 11:20 AM
9 Bloque C 11:25 AM 12:45 PM
.......


notice the : in both columns..

So how can i do that??.. thank you guys!

Reply With Quote
  #2  
Old June 27th, 2003, 03:32 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Is this T-SQL? You should be able to insert a literal ':' in your convert format.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Inserting string in the query... for retriving data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway