Jump to content

sql help needed


Recommended Posts

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
Link to comment
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.

Link to comment
Share on other sites

Link to comment
Share on other sites

@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
Link to comment
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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...