c# - How to solve the subquery -


i have data this

sr_no/ accessionno  / roll_no   / price ---------------------------------------     1  /     101     /      45   /     1000 2  /     102        /   46     /   2000 3   /    101       /    43    /    500 

i have written query

select *  circulation  max(sr_no) in (select *                       circulation                       accessionno = @accessionno) 

i want values accession no given textbox , should the maximum value of sr_no , info sr_no auto incremented.

my query not working

i student , started c# quite few months ago

sorry bad english

i got error

an aggregate may not appear in where
clause unless in subquery contained in having clause or select list, , column being aggregated outer reference.
1 expression can specified in select list when subquery not introduced exists.

i want when type 101 accession no. return info

3   /    101       /    43    /    500 

you wanted this:

select *  circulation  sr_no = (select max(sr_no)                circulation                 accessionno = @accessionno) 

you want select row(s) circulation sr_no column equals maximum of sr_no values in table - right?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -