problem in select sql query
-
hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:
-
hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:
Hi, the WHERE clause supports logic operators AND, OR, NOT as well as parentheses, so you could do things like
SELECT ... FROM ... WHERE (field1='jan' OR field1='feb') AND NOT field2=12 ORDER BY ...
:)Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, the WHERE clause supports logic operators AND, OR, NOT as well as parentheses, so you could do things like
SELECT ... FROM ... WHERE (field1='jan' OR field1='feb') AND NOT field2=12 ORDER BY ...
:)Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
thanks for reply i have done this by select headname,frequency,sum(c1) from feeshead where months in('jan','feb','march')group by headname,frequency
-
hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:
Select SUM(fees) FROM TABLENAME WHERE headname = 'jan' OR 'feb' OR 'march' NOTE: The (fees) in the query is the name of the column and the "TABLENAME" should be replaced with the table you want to perform de query on. NOTE ALSO: that SQL SERver is not case sensitive Jondo