Link to home
Start Free TrialLog in
Avatar of sasha85
sasha85

asked on

'as' blocks

i need to set a query with

left(uname,1)='a' or left(uname,1)='b' or left(uname,1)='c' AS abc
,left(uname,1)='d' or left(uname,1)='e' or left(uname,1)='f' AS def

some thing like this that i will be able to print as
response.write rs("abc")...
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85
sasha85

ASKER

yes...but how can i set it inside sql query?

mysql="?"
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85

ASKER

mysql="SELECT CASE WHEN left(uname,1) IN('ó','ó',ó') then uname else null end AS abc,CASE WHEN left(uname,1) IN('ó','ó',ó"') then uname else null end AS def FROM demo_users"

MySQL][ODBC 3.51 Driver][mysqld-4.1.21-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '×') then uname else null end AS abc,CASE WHEN left(uname,1) IN('×','×',×"') t' at line 1
Avatar of sasha85

ASKER

i mean
mysql="SELECT CASE WHEN left(uname,2) IN('ó','ó',ó') then uname else null end AS abc,CASE WHEN left(uname,2) IN('ó','ó',ó"') then uname else null end AS def FROM demo_users"

left(uname,2)

cause there are 2 chars...

but still this is query syntax...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85

ASKER

I FOUND THE PROB...there was (') missing in the 3 part...
Avatar of sasha85

ASKER

ok than...how now i can print all the abc records first and then all the def?
Avatar of sasha85

ASKER

i mean in 2 groups...
Avatar of sasha85

ASKER

do i realy need to run on the all records 2 time ?
first to take out the abc and second time for the def?
or there is better way?
Avatar of sasha85

ASKER

if i will just
response.write "abc:" & xabc & "<br>"
response.write "def:" & xdef & "<br>"

it will print <br> instead of records wich got no abc or def...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85

ASKER

i got only one column...wich i want to divide into abc\def...
my plan is to print each rs("abc"),rs("def")...into diffrent div..
<div id=abc
<div id=def
...
please explain more, what data you have as input in the column. just so we understand...
what is the div's about...

Avatar of sasha85

ASKER

sorry i dropped this idea