User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 456,492 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,685 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 1583 | Replies: 8
Reply
Join Date: Aug 2007
Posts: 14
Reputation: jayz_raul is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
jayz_raul's Avatar
jayz_raul jayz_raul is offline Offline
Newbie Poster

retrieve data

  #1  
Sep 21st, 2007
hye...im having difficulities to retrieve data from one table. i need to retrieve data from few columns and multiple rows in one table and display it the data. is there any way of doin it?
urgent help need!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: retrieve data

  #2  
Sep 21st, 2007
Sql Server 2000 or 2005 ? I ask as it depends what GUI to use for the following TSQL code. Sql 2000 Start->Programs->Ms Sql Server->Query Analyser File->Connect click OK, select the database name in the drop down box, paste the code in, clcik the green play icon in the toolbar or press F5 key. For Sql 2005 Start -> programs -> Ms Sql Server 2005 -> Sql Server Managent Studio Click New Query in toolbar, select the database in the drop down box, past the code in the query pane on the right, click execute button.

You need obviously to overtype the column names and table names and criteria as I had to make those up cos you didn't post enough info! Naughty you!
select 
    columnname1, columnname2 
from 
    table name 
where 
   columnname = somevalue
Last edited by hollystyles : Sep 21st, 2007 at 5:35 am.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: jayz_raul is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
jayz_raul's Avatar
jayz_raul jayz_raul is offline Offline
Newbie Poster

olrite

  #3  
Sep 23rd, 2007
i olready reply what exactly my problem. anyway thankz for u reply...
Reply With Quote  
Join Date: Mar 2007
Location: Israel
Posts: 16
Reputation: Shaffer is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
Shaffer Shaffer is offline Offline
Newbie Poster

Re: retrieve data

  #4  
Sep 21st, 2007
Hello,
I need to know how many rows, and by what parameters, so that I can help you.

Shaffer.
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: jayz_raul is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
jayz_raul's Avatar
jayz_raul jayz_raul is offline Offline
Newbie Poster

Re: retrieve data

  #5  
Sep 22nd, 2007
ok..here further information about my table structure.
Table : Results
Metric_Num, Sub_Code, Gred, GPA, CGPA, Status
12345 TMM10011 A 3.00 2.99 PASS

Above is columns under table Results. So now I need to retrieve all data’s under a particular metric number. Means if I request 12345, all the data should be displayed but Gpa, Cgpa and Status must be displayed only once.

The Output should be like this:

TMX2011 B,TMN 2013 A 3.00 3.00 lulus
Reply With Quote  
Join Date: Aug 2005
Posts: 4,832
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 324
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: retrieve data

  #6  
Sep 23rd, 2007
I don't know, try looking at a tutorial maybe?
http://www.intermedia.net/support/sql/sqltut.asp

Or were you expecting someone to write every sql query you dream up from you?
... the hat of 'is this a cat in a hat?'
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: jayz_raul is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
jayz_raul's Avatar
jayz_raul jayz_raul is offline Offline
Newbie Poster

nope

  #7  
Sep 23rd, 2007
thankz for ur reply... i already had the whole code for retrieve the data
im trouble to retrieve certain column and also i cant retrieve all the data.
i'll try annyway..
Reply With Quote  
Join Date: Mar 2007
Location: Israel
Posts: 16
Reputation: Shaffer is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
Shaffer Shaffer is offline Offline
Newbie Poster

Re: retrieve data

  #8  
Sep 25th, 2007
Hello,
I hope this will work for you:
SELECT * FROM table_name WHERE Metric_Num='12345' AND  UNIQUE(GPA) AND UNIQUE(CGPA) AND UNIQUE(Status);

Happy Jewish New Year!
Shaffer.
Reply With Quote  
Join Date: Aug 2007
Posts: 14
Reputation: jayz_raul is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
jayz_raul's Avatar
jayz_raul jayz_raul is offline Offline
Newbie Poster

Re: retrieve data

  #9  
Sep 26th, 2007
it works for unique values. but i cant retrieve all from sub_code and gred. Any idea on why?
i only can retrieve one row
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 3:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC