Hi all ,
I need to insert a value in to a table if that value does not exist more then twice , If once that value exist then it should insert only once .. could any one guide me..
thanks in advance

Recommended Answers

All 3 Replies

you need to use nested queries. in the sub query get all the rows which have values=yourNewValue and count the number of rows you have recieved.
then in the super query check if count is less the 2 then insert the new value
Hope it answers your question.

thanks for your replay ,
could you tell the query because I should not use stored procedure

anand01, you need to do some research before you come asking for something. You have to give (the problem with your code) to recieve (the time and help that people give you). So post your code on what you are haveing problems with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.