Hello!
How can I emulate PostreSQL function select generate_series?
==============
Example:
select generate_series(1,7);
1
2
3
4
5
6
7
==============
My task is this:
create table direction_telephony (
group_name text not null,
name text not null,
class text not null,
prefix text not null,
price real not null,
currency text not null default 'RUB'
);
insert into direction_telephony values ('Globus
daily', 'Russia','','7','3.0','RUB');
insert into direction_telephony values ('Globus daily', 'N.Novgorod
Region','','7831','2.0','RUB');
insert into direction_telephony values ('Globus
daily', 'N.Novgorod','','78312','1.0','RUB');
select * from direction_telephony
where prefix in
('78312604812','7831260481','783126048','78312604','7831260','783126','78312','7831','783','78','7')
order by length(prefix) desc
limit 1;
Globus daily|N.Novgorod||78312|1.0|RUB
With generate_series function I can generate
condition
"('78312604812','7831260481','783126048','78312604','7831260','783126','78312','7831','783','78','7')"
inside query.
select substr('78312604812',1,x) from generate_series(1,length('78312604812'))
as x;
"7"
"78"
"783"
"7831"
"78312"
"783126"
"7831260"
"78312604"
"783126048"
"7831260481"
"78312604812"
Best regards, Alexey.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users