473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to write a for loop in mysql and retrive the data

seshu
156 100+
Hi Everybody
well i shall explain the problem first i have designed a small attendance software which is connected to threee tables
1)userdetails
2)attendance
3)absenties
now i am able insert the records of all the candidates
and i am able to generate the absenties list by writing this query
Expand|Select|Wrap|Line Numbers
  1. select name from userdetails where  NOT EXISTS (select name from attendance where attendance.name = userdetails.userloginid and attendance.log_date=Respective date)
but the problem here is iam able to write a query which will generate the absenties list for only one day are the day i want but i want to see for from date to to date even and i think this is possible by writing for loop

hope iam clear
Mar 26 '07 #1
2 9079
code green
1,726 Expert 1GB
Not sure what you want but you can expand your query
Expand|Select|Wrap|Line Numbers
  1. select name from userdetails where  NOT EXISTS 
  2. (select name from attendance where 
  3. attendance.name = userdetails.userloginid and attendance.log_date=Respective date)
Try changing WHERE condition to
Expand|Select|Wrap|Line Numbers
  1. attendance.log_date> minimum_date AND attendance.log_date< maximum_date 
or using
Expand|Select|Wrap|Line Numbers
  1. attendance.log_date BETWEEN (minimum_date,maximum_date) 
Mar 27 '07 #2
ronverdonk
4,258 Expert 4TB
The format for the MySQL BETWEEN operator is
Expand|Select|Wrap|Line Numbers
  1. expression BETWEEN minvalue AND maxvalue 
Ronald :cool:
Mar 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Me | last post by:
Hi there I guess I am what you would call a newbie to php and mySQL... Ive just created my first guestbook "tagwall" in php using a mysql database to store the messages. So far so good, it works...
2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
0
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation ...
0
by: Vijay | last post by:
Hello friends, I have a problem with one of the JOIN query here. Below is a brief description of the problem. tablename : test RecordId EffectiveDate othertableid value -------- ...
2
by: Lal | last post by:
I have listbox with 10 items I selected 5 of them from the listbox i want to retrive the selected data in a for - loop command how can it possible please help me --
8
by: asenthil | last post by:
Hai, i'm having a string in a specific field of a database... now i want to retrive that string from the database and i have to write that string into a xml file.... retriving is not a...
9
by: asenthil | last post by:
Hai to all,, i had to tried to retrive and write a single row to a file from the database.. But dont know to write all the retrived rows to a file from the database.. how to do that... ...
1
by: robertaraj | last post by:
Hi all...!! I am very new to MYSQL. Now the problem I am facing is, I have to connect, store and retrive the data in mysql from one system to another system. The systems are using WIN XP....
1
by: swethak | last post by:
hi, when i run a java program for to store data and retrive using mysql datatabse i got the following errors.I think in that one of error is due to set the class path.I placed my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.