•
•
•
•
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 397,789 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,413 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:
Views: 2935 | Replies: 1
![]() |
•
•
Join Date: May 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I have a table in MS SQL Server 7.0 Like this:
Id Cat_Name Definition Image
101 A1 --------------- *************
102 B1 ----------- *************
101 A2 ------------------ *************
103 C1 ----------------- *************
101 A3 --------------- *************
101 A4 ------------------ *************
102 B2 -------------------- *************
101 A5 -------------- *************
101 A6 ----------------- *************
From above table, How can I select 3 – 5 records where iId is 101. Means result should be:
<<101>><<A3>>----------------<<***********>>
<<101>><<A4>>----------------<<***********>>
<<101>><<A5>>----------------<<***********>>
Id Cat_Name Definition Image
101 A1 --------------- *************
102 B1 ----------- *************
101 A2 ------------------ *************
103 C1 ----------------- *************
101 A3 --------------- *************
101 A4 ------------------ *************
102 B2 -------------------- *************
101 A5 -------------- *************
101 A6 ----------------- *************
From above table, How can I select 3 – 5 records where iId is 101. Means result should be:
<<101>><<A3>>----------------<<***********>>
<<101>><<A4>>----------------<<***********>>
<<101>><<A5>>----------------<<***********>>
•
•
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation:
Rep Power: 4
Solved Threads: 19
might be able to help you with this but need a few questions answered.
1) I am assuming that ID+Cat_Name is unique, in other words, there cannot be two 101 A1 entries. is this correct?
2) what are specifications for the Cat_Name field? Is it always exactly two characters(one letter and then one number) or can it be one letter followed by any integer, etc.
3) you said 3-5 rows returned. Do you want that number random as well, or can it be the same number of rows returned everytime as long as that number is between 3-5?
1) I am assuming that ID+Cat_Name is unique, in other words, there cannot be two 101 A1 entries. is this correct?
2) what are specifications for the Cat_Name field? Is it always exactly two characters(one letter and then one number) or can it be one letter followed by any integer, etc.
3) you said 3-5 rows returned. Do you want that number random as well, or can it be the same number of rows returned everytime as long as that number is between 3-5?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
ad advertising ajax architecture asp backup beta business centro crash daniweb database dell developer development doubleclick enterprise google gpt guid partition table hacker internet linux longhorn mail microsoft mmorpg msdn news novell office open partition qmail red hat rhel security server smtp software source sql survey suse vista windows windows server
- SQL SERVER 2000 Selecting a record based on an aggregate function (MS SQL)
- Identity Column Problem in MS SQL Server when moving data from using Bulk Copy (MS SQL)
- Identity Column Problem in MS SQL Server (MS SQL)
- Autonumber in a SQL Server table (MS SQL)
- Select records from different data source (MS SQL)
- Query conversion from Sybase to MS SQL Server 2000 (MS SQL)
Other Threads in the MS SQL Forum
- Previous Thread: My zipcode query is not returning the correct results
- Next Thread: A simple question about hot key


Linear Mode