Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find more than 50 records.

Author  Topic 

ashutosh011283
Starting Member

6 Posts

Posted - 2011-08-05 : 01:56:29
HI All,

Que:- I have two tables Users & Friends,there are lots of record in both tables as per below details

Table1 (Users)
ID(FK) Name Gender

Table2 (Friends)
ID(PK) profession

I would like to know - find more than 50 records from the tables with Name,profession and gender= female only

Please give me response ASAP.....

ashutosh upadhyay

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-08-05 : 01:59:42
ashutosh, just one question. If there are less than 50 records, do you not want to return any values? So for example, if there are only 49 records, would you show 0 records?
Go to Top of Page

ashutosh011283
Starting Member

6 Posts

Posted - 2011-08-05 : 02:11:04
yes exactly

ashutosh upadhyay
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-05 : 02:18:44
quote:
Originally posted by ashutosh011283

yes exactly

ashutosh upadhyay



can you explain further ? If you have only 49 records what to show for the 50th record ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-08-05 : 02:30:49
Any chance you could run the following queries against your data and post the results:

Select 'insert into users (id, name, gender) values ('+convert(varchar(10), id)+','+name+','+gender+');'
From Users

Select 'insert into friends (id, profession) values('+convert(varchar(10), id)+','+profession+');'
From Friends

This way we can get some sample data to insert and provide results
Go to Top of Page
   

- Advertisement -