Sign in to follow this  
Followers 0
erikson

sql help needed

6 posts in this topic

#1 ·  Posted (edited)

hi all

i have some questions regards sql

so i have a db with 2 fields

the first field is the nr.crt ( 1, 2 , 3 etc )

the second field is "free" and contains 1 or 0

i insert this querry

$sQuery = "SELECT nr.crt FROM db_name WHERE free='1' "

to select get all the fields who contain in the "free" value 1

now all i whant is that i can write somewere this fields

example

------------------

nr.crt | free |

------------------

1 | 1 |

------------------

2 | 0 |

------------------

3 | 1 |

------------------

4 | 1 |

------------------

so i whant to write somewere the fields who contain 1

like :

1 , 3, 4

can anyone tell me if this is possible and how to do it?

note thet i used mysql.au3

Edited by erikson

Share this post


Link to post
Share on other sites



hi all

i have some questions regards sql

so i have a db with 2 fields

the first field is the nr.crt ( 1, 2 , 3 etc )

the second field is "free" and contains 1 or 0

i insert this querry

$sQuery = "SELECT nr.crt FROM db_name WHERE free='1' "

to select get all the fields who contain in the "free" value 1

now all i whant is that i can write somewere this fields

example

------------------

nr.crt | free |

------------------

1 | 1 |

------------------

2 | 0 |

------------------

3 | 1 |

------------------

4 | 1 |

------------------

so i whant to write somewere the fields who contain 1

like :

1 , 3, 4

can anyone tell me if this is possible and how to do it?

It's possible, but which version of SQL are you talking about?

MySQL?

Microsoft SQL?

Oracle?

Normally, "nr.crt" would be an illegal field name, because the letters before the dot refer to the name of the database.

Share this post


Link to post
Share on other sites

MySQL - 4.0.21-nt

Protocol version: 10

with ODBC 3.51 DRIVER

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@erikson

The best way to get started with SQL is looking here :

SQL School

by the way the link shows you how to do an UPDATE statement need to write something to the DB

Regards

ptrex

dude you just don`t understaind what i ask ....

for the others i find the solution

CODE
$var = _Query($sql,"SELECT * FROM table WHERE free = '1' ")

With $var

While NOT .EOF

FileWriteLine("c:\test.txt",.Fields("numar").value & @CRLF)

.MoveNext

WEnd

EndWith

ps . i know sql

Edited by erikson

Share this post


Link to post
Share on other sites

dude you just don`t understaind what i ask ....

for the others i find the solution

CODE
$var = _Query($sql,"SELECT * FROM table WHERE free = '1' ")

With $var

While NOT .EOF

FileWriteLine("c:\test.txt",.Fields("numar").value & @CRLF)

.MoveNext

WEnd

EndWith

ps . i know sql

Does that mean you solved what you were looking for?

Because I read your initial post that you were trying to get a comma separated list of those entries with "free" set to 1 (which your code snippet is close to but not quite there yet).

If I'm wrong, try to be a better communicator, please :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0